fixed #1 (mixed up arrow-directions) by removing the usage of networkx and pandas

This commit is contained in:
W13R 2021-12-12 20:42:10 +01:00
parent 67e7bcc6fb
commit 66c7c9b963
5 changed files with 10 additions and 34 deletions

View file

@ -1,13 +1,16 @@
from networkx import from_pandas_edgelist
from pandas import DataFrame
from pyvis.network import Network
def pyvis_graph_from_pandas_DF(pandas_df:DataFrame, source_column:str="link1", target_column:str="link2", heading:str=None) -> Network:
from .linkmap import LinkMap
def pyvis_graph_from_linkmap(linkmap:LinkMap, heading:str=None) -> Network:
nx = from_pandas_edgelist(pandas_df, source=source_column, target=target_column)
pyvis_net = Network(bgcolor="#222222", font_color="#fafafa", width="100%", height="95%", directed=True)
pyvis_net.from_nx(nx, default_node_size=8)
pyvis_net.add_nodes(linkmap.links, size=[8]*len(linkmap.links))
pyvis_net.add_edges(linkmap.link_connections)
if heading != None:
pyvis_net.heading = heading + """

View file

@ -1,21 +0,0 @@
from pandas import DataFrame
from .linkmap import LinkMap
def linkmap2pandasDF(linkmap:LinkMap) -> DataFrame:
data_connections = {
"link1": [],
"link2": []
}
for c in linkmap.link_connections:
link1, link2 = c
data_connections["link1"].append(link1)
data_connections["link2"].append(link2)
df = DataFrame(data=data_connections)
return df