igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Retrieve nodes forming a motif with subgraph_isomorphisms


From: Tamas Nepusz
Subject: Re: [igraph] Retrieve nodes forming a motif with subgraph_isomorphisms
Date: Mon, 10 Aug 2015 11:18:17 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

> The oncoming questions are: what is the most efficient way to find the
> incident edges of the current edge?
If your graph is relatively small and you are going to perform this type of
query many times, the easiest it to create the line graph of the graph and then
use neighbors() on the line graph. This works because every vertex of the line
graph corresponds to the edge with the same index in the original graph, and
two vertices in the line graph are connected if the corresponding edges share
a vertex in the original graph. So, something like:

g_LineGraph <- line.graph(g_OriginGraph)
IncidentEdgeIds <- neighbors(g_LineGraph, CurrentEdgeId)

You can basically consider the line graph as an efficient data structure that
pre-computes and lists all edges incident on a specific edge in the original
graph.

T.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]