Skip to content

Multigraphs

Jordan Matelsky edited this page Jul 1, 2022 · 2 revisions

Multigraphs are graphs where there can be more than one edge between two vertices.

Different executors handle multigraphs very slightly differently, so multigraph support is still exerimental in DotMotif. You can search for multigraph motifs if you pass a multigraph to most executors, but there are a few caveats if you want to attach attributes. Also keep in mind that the multigraph search space will be WAY bigger, so this may impact runtime!

See #107 for more thoughts on implementation details.

Another option is to "collapse" the network so that multiedges are represented by an attriubte on a single edge (i.e., "synapse_count") and then use it like this:

A -> B [synapse_count > 2]

Edge Match Strategies

GrandIso and NetworkX executors take a multigraph_edge_match argument that can be used like this, by passing either any or all:

import networkx as nx
from dotmotif.executors import GrandIsoExecutor

g = nx.MultiDiGraph()
...

E = GrandIsoExecutor(graph=g, multigraph_edge_match="any")

If 'any', then any edge between nodes can match the constraints to satisfy the motif. If 'all', then all edges between nodes must match the constraints to satisfy the motif.