def Draw_Suspect_Fraud_Node (suspect, Anomalies_Subgraph): import d3py import networkx as nx import random Anomalies_Subgraph = nx.ego_graph(Anomalies_Subgraph,suspect,radius=3) name = str(random.random()) + "_graph" with d3py.NetworkXFigure(Anomalies_Subgraph, name=name,width=1000, height=1000) as p: p += d3py.ForceLayout() p.css['.node'] = {'fill': 'blue', 'stroke': 'magenta'} p.show()
def draw_d3_graph(RG): if module_exists('d3py'): import d3py with d3py.NetworkXFigure(RG, width=1500, height=1500) as p: p += d3py.ForceLayout() p.css['.node'] = {'fill': 'blue', 'stroke': 'magenta', 'title': 'bla'} p.css['.link'] = {'stroke': 'red', 'stoke-width': '3px'} p.show() else : print >> sys.stderr, 'Need to install Module: "d3py"' return
import pandas as pd import d3py import networkx as nx df = pd.DataFrame().from_csv("sna_example1.csv", index_col=False) G = nx.from_pandas_dataframe(df, "source", "target") with d3py.NetworkXFigure(G, name="graph", width=200, height=200) as p: p += d3py.ForceLayout() # To Do - add labels to d3py graphs p.css['.node'] = { 'fill': 'blue', 'stroke': 'magenta', 'label': 'test', "font-family": "Arial", "font-size": 12 } p.save() p.show()