-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGraphviz.py
More file actions
38 lines (29 loc) · 875 Bytes
/
Copy pathGraphviz.py
File metadata and controls
38 lines (29 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 19 22:03:21 2017
@author: teemuko
"""
import networkx as nx
import matplotlib.pyplot as plt
#from networkx.drawing.nx_pydot import write_dot
from networkx.drawing.nx_agraph import write_dot
from networkx.drawing.nx_agraph import graphviz_layout
pos = graphviz_layout(G)
#G=nx.Graph()
#G.add_nodes_from([2,3,'fooba','mollo'])
#G.add_edge(1,2)
MG=nx.MultiDiGraph()
MG.add_nodes_from([1,2,3],label='baa')
MG.add_weighted_edges_from([(1,2,0.5), (2,1,0.5), (2,3,.5)],label="foo")
MG.degree(weight='weight')
nx.draw(MG)
#nx.draw(MG,pos=nx.spring_layout(MG)) # use spring layout
#nx.draw_networkx(MG,labels={'label'})
#write_dot(MG,'multi.dot')
#nx.draw(MG, pos, prog='neato')
#G=nx.MultiGraph()
#G.add_edge(1,2)
#G.add_edge(1,2)
#nx.write_dot(G,'multi.dot')
#nx.draw(G, pos, prog='neato')
#!neato -T png multi.dot > multi.png