Commit 710070d3 authored by dirk.wintergruen's avatar dirk.wintergruen
Browse files

logging added

parent 885080f1
......@@ -5,7 +5,8 @@ Some helpers to plot the networks with plotly (https://plot.ly)
import plotly.graph_objs as go
import numpy as np
import igraph
import logging
logger = logging.getLogger(__name__)
def \
createSizeFromFunc(gr: igraph.Graph, func: str = "betweenness", min_size: float = 2, scale_size: float = 10) -> np.array:
"""
......@@ -27,7 +28,7 @@ def \
return sizes
def createFigGraph(gr: igraph.Graph, title: str, hover_field:str = "label", sizes: object = 2, typ_field: str = None, pos: list = None) -> go.Figure:
def createFigGraph(gr: igraph.Graph, title: str = "", hover_field:str = "label", sizes: object = 2, typ_field: str = None, pos: list = None) -> go.Figure:
"""
create figure for plotly
......@@ -44,7 +45,9 @@ def createFigGraph(gr: igraph.Graph, title: str, hover_field:str = "label", size
typs = set(gr.vs[typ_field])
Zn =gr.vs[typ_field]
if not pos:
logging.debug("create positions")
pos = gr.layout_fruchterman_reingold()
Xn = [k[0] for k in pos.coords] # x-coordinates of nodes
Yn = [k[1] for k in pos.coords] # x-coordinates of nodes
......@@ -54,6 +57,7 @@ def createFigGraph(gr: igraph.Graph, title: str, hover_field:str = "label", size
Xe = []
Ye = []
Ze = []
logging.debug("create edges")
for e in gr.es:
Xe += [pos.coords[e.source][0], pos.coords[e.target][0], None] # x-coordinates of edge ends
Ye += [pos.coords[e.source][1], pos.coords[e.target][1], None]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment