Skip to content

Commit

Permalink
adjusted visualizations for start-end model
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Oct 7, 2019
1 parent 2d7bc3e commit 6450aaf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/macrogen/etc/styles.yaml
Expand Up @@ -2,6 +2,10 @@
node:
date:
shape: none
start:
shape: rarrow
end:
shape: larrow
# additional style for highlighted nodes
highlight:
fillcolor: '#F0F000' # '#FABE00'
Expand Down Expand Up @@ -37,6 +41,9 @@ edge:
copy:
arrowhead: empty
penwidth: 0.5
progress:
color: gray
label: ""

# additional style for conflicting edges
delete:
Expand Down
4 changes: 4 additions & 0 deletions src/macrogen/splitgraph.py
Expand Up @@ -38,6 +38,10 @@ def __getattr__(self, item):
def filename(self) -> Path:
return self.reference.filename

@property
def label(self) -> str:
return self.reference.label # XXX start/end?

def __str__(self):
return f"{self.reference} ({self.side.label})"

Expand Down
2 changes: 2 additions & 0 deletions src/macrogen/uris.py
Expand Up @@ -292,6 +292,8 @@ def get(cls, uri, allow_duplicate=True):
cls._load_paralipomena()

orig_uri = uri
if '#' in uri:
uri = uri[:uri.index('#')]
uri = uri.replace('-', '_')

if uri in cls.corrections:
Expand Down
10 changes: 7 additions & 3 deletions src/macrogen/visualize.py
Expand Up @@ -15,10 +15,11 @@

from .config import config
from .datings import add_timeline_edges
from macrogen import BiblSource
from macrogen.graphutils import pathlink
from .bibliography import BiblSource
from .graphutils import pathlink
from .uris import Reference
from .graph import Node
from .splitgraph import SplitReference
import logging

logger: logging.Logger = config.getLogger(__name__)
Expand All @@ -38,9 +39,12 @@ def simplify_graph(original_graph: nx.MultiDiGraph) -> nx.MultiDiGraph:
attrs['kind'] = 'date'
translation[node] = node.isoformat()
elif isinstance(node, Reference):
attrs['kind'] = node.__class__.__name__
attrs['label'] = node.label
translation[node] = node.uri
if isinstance(node, SplitReference):
attrs['kind'] = node.side.value
else:
attrs['kind'] = node.__class__.__name__
_simplify_attrs(attrs)

nx.relabel_nodes(graph, translation, copy=False)
Expand Down

0 comments on commit 6450aaf

Please sign in to comment.