Last active
October 5, 2015 20:59
-
-
Save jamilatta/1bfa61203df58016ab22 to your computer and use it in GitHub Desktop.
Grafo de dependências de requisitos funcionais (Projeto Site)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import | |
from __future__ import unicode_literals | |
from __future__ import print_function | |
from __future__ import division | |
import pygraphviz as pgv | |
G = pgv.AGraph(directed=True) | |
G.node_attr['style'] = 'filled' | |
G.node_attr['shape'] = 'circle' | |
G.node_attr['fontcolor'] = '#000000' | |
G.graph_attr['label'] = 'Grafo de depêndencia' | |
for i, line in enumerate(open('input.csv')): | |
split_line = line.split(',') | |
for j, col in enumerate(split_line): | |
if col == 'x': | |
G.add_edge(i+1, j, label='depende') | |
else: | |
G.add_node(i+1) | |
print(G.string()) # print to screen | |
print("Wrote pending_graph.dot") | |
G.write('pending_graph.dot') # write to simple.dot | |
B = pgv.AGraph('pending_graph.dot') # create a new graph from file | |
B.layout() # layout with default (neato) | |
B.draw('pending_graph.png', prog="circo") # draw png | |
print("Wrote pending_graph.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment