CS-7863-Sci-Stat-Final/Analysis/segment_network.py
2023-05-02 00:04:52 -05:00

29 lines
640 B
Python

#!/usr/bin/python3
import networkx as nx
import matplotlib.pyplot as plt
from collections import OrderedDict
from operator import getitem
import itertools, os, sys
A = nx.drawing.nx_agraph.to_agraph(nx.drawing.nx_pydot.read_dot("./1_mo_color_DOTFILE.dot"))
A.layout('dot')
#A.draw('tree.png')
A.remove_node('\\n') # Remove "newline" node from newline end of dot file
G=nx.DiGraph(A)
print(A.get_edge_data(0, 1))
subgraph = []
to_explore = []
to_explore.append('0')
for node in to_explore:
for edge in list(G.out_edges(node)):
print(edge)
print()
for u, v, d in G.edges(data=True):
print(u, v, d['label'])
#for node in A: