jackzellweger
jackzellweger

Reputation: 378

Convert to directed graph to undirected graph in Python igraph

I am attempting to draw an undirected graph in iGraph, but the graph I draw seems to have little arrows on it still. Is it possible to convert the directed graph object to an undirected graph object, so that the arrows are gone?

Here's my code:

import igraph
import cairo
import igraph
graph = igraph.Graph.Read_Ncol('network.txt')
igraph.plot(graph)

network.txt =

1 2
2 1
2 3
2 7
3 1
4 2
4 6
5 4
5 6
7 4
7 8
8 9
9 7
10 7
10 8
10 9
11 2
1 2
3 4
5 8
12 3
1 1

Upvotes: 1

Views: 5219

Answers (1)

nbryans
nbryans

Reputation: 1527

As documented here: http://igraph.org/python/doc/igraph.GraphBase-class.html

There are functions:

to_directed()
to_undirected()

Depending on which way you want to go (it isn't clear to me from the title).

Upvotes: 2

Related Questions