Skip to content

Commit

Permalink
improved default behavior of node linking and node labeling. The firs…
Browse files Browse the repository at this point in the history
…t in a node value wins for linking and the first wins for labeling. This makes all kinds of ADTs and tuples easier to use for a first version of the graph visualization
  • Loading branch information
jurgenvinju committed Feb 14, 2024
1 parent 1815671 commit aacd5bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/org/rascalmpl/library/vis/Graphs.rsc
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ Content graph(rel[&T x, &L edge, &T y] v, NodeLinker[&T] nodeLinker=defaultNodeL
= content(title, graphServer(cytoscape(graphData(v, nodeLinker=nodeLinker, nodeLabeler=nodeLabeler), \layout=\layout, nodeStyle=nodeStyle, edgeStyle=edgeStyle)));
alias NodeLinker[&T] = loc (&T _id1);
loc defaultNodeLinker(loc l) = l;
loc defaultNodeLinker(/loc l) = l;
default loc defaultNodeLinker(&T _) = |nothing:///|;
alias NodeLabeler[&T]= str (&T _id2);
str defaultNodeLabeler(&T v) = "<v>";
loc defaultNodeLinker(/str s) = s;

This comment has been minimized.

Copy link
@DavyLandman

DavyLandman Feb 14, 2024

Member

This return type can't be right?

This comment has been minimized.

Copy link
@jurgenvinju

jurgenvinju Feb 14, 2024

Author Member

already fixed. the type-checker complained too

default str defaultNodeLabeler(&T v) = "<v>";
alias EdgeLabeler[&T]= str (&T _source, &T _target);
str defaultEdgeLabeler(&T _source, &T _target) = "";
Expand Down

0 comments on commit aacd5bd

Please sign in to comment.