igraph-help
[Top][All Lists]
Advanced

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

[igraph] help with gadget replacement


From: Raphael C
Subject: [igraph] help with gadget replacement
Date: Tue, 12 Nov 2013 20:33:04 +0000

I quite often need to replace nodes with little graphs as gadgets and
I haven't quite got used to how to do this in igraph (python). In this
case this is the rule.

Assume the graph is directed and weighted with positive weights.  For
every node X with outdegree > 1, here is an example to demonstrate
what I would like to do.

Assume we have incoming edges

A->X with weight x1
B->X with weight x2

and outgoing edges

X->D with weight x3
X->E with weight x4
X->F with weight x5

I would like to replace X with three nodes (the same as the outdegree)

X1->D with weight x3
X2->E with weight x4-1
X3->F with weight x5-2

and connect A and B to X1 with the same weight they had before when
connected to X

and add X1->X2 with weight 1 and X2->X3 with weight 1.

The end result should be that all nodes have outdegree at most 1 and
all paths between "1" versions of nodes should have the same cost as
they had before.


Any help very much appreciated.

Raphael



reply via email to

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