是否有用于在 Data Science Studio 中创建网络图的处理器?
is there a processor for creating a network graph in Data Science Studio?
我的数据有三列,每列代表树中的一个节点 (a->b->c),我很好奇是否存在帮助准备数据导入 Neo4j、NetworkX 或其他工具的方法相当于 graph/network 资源管理器。预先感谢您对将表格数据转换为图形格式的任何见解。
这是一个简单的python脚本示例,可以进行对话(如果我正确理解你的问题):
import networkx as nx
import string
str = "a,b,c\nd,e,f\nd,k,j"
print str
lines = string.split(str,'\n')
DG=nx.DiGraph()
for line in lines:
nodes = line.split(",")
location = nodes[0]
manager = nodes[1]
report = nodes[2]
if (location not in DG):
DG.add_node(location)
if (manager not in DG):
DG.add_node(location)
if (report not in DG):
DG.add_node(location)
DG.add_edge(location,manager)
DG.add_edge(manager,report)
print DG.nodes()
print DG.edges()
此代码将 str
字符串转换为有向图。
我的数据有三列,每列代表树中的一个节点 (a->b->c),我很好奇是否存在帮助准备数据导入 Neo4j、NetworkX 或其他工具的方法相当于 graph/network 资源管理器。预先感谢您对将表格数据转换为图形格式的任何见解。
这是一个简单的python脚本示例,可以进行对话(如果我正确理解你的问题):
import networkx as nx
import string
str = "a,b,c\nd,e,f\nd,k,j"
print str
lines = string.split(str,'\n')
DG=nx.DiGraph()
for line in lines:
nodes = line.split(",")
location = nodes[0]
manager = nodes[1]
report = nodes[2]
if (location not in DG):
DG.add_node(location)
if (manager not in DG):
DG.add_node(location)
if (report not in DG):
DG.add_node(location)
DG.add_edge(location,manager)
DG.add_edge(manager,report)
print DG.nodes()
print DG.edges()
此代码将 str
字符串转换为有向图。