<< chain_struct Chemins - Cycles convex_hull >>

metanet >> metanet > Chemins - Cycles > circuit

circuit

trouve un circuit ou la fonction de rang dans un graphe orienté

Séquence d'appel

[p,r] = circuit(g)

Paramètres

g

graphe (liste)

p

vecteur ligne des numéros des arcs du circuit s'il existe

r

vecteur ligne de la fonction de rang s'il n'y a pas de circuit

Description

circuit essaye de trouver un circuit pour le graphe orienté g. Elle renvoie, s'il existe, le circuit p en temps que vecteur ligne des numéros d'arcs correspondants et renvoie le vecteur vide [] sinon. Si le graphe n'a pas de circuit, la fonction de rang est renvoyée dans r, sinon sa valeur est le vecteur vide [].

Exemples

// graph with circuit
ta=[1 1 2 3 5 4 6 7 7 3 3 8 8 5];
he=[2 3 5 4 6 6 7 4 3 2 8 1 7 4];
g=make_graph('foo',1,8,ta,he);
g.nodes.graphics.x=[116 231 192 323 354 454 305 155];
g.nodes.graphics.y=[ 118 116 212 219 117 185 334 316];
g.nodes.graphics.display='number';
g.edges.graphics.display='number';

show_graph(g);
p=circuit(g)
hilite_edges(p)

// graph without circuit
g1=make_graph('foo',1,4,[1 2 2 3],[2 3 4 4]);
g1.nodes.graphics.x=[116 231 192 323];
g1.nodes.graphics.y=[ 118 116 212 219];
g1.nodes.graphics.display='number';
g1.edges.graphics.display='number';

show_graph(g1,'new');
[p,r]=circuit(g)

Report an issue
<< chain_struct Chemins - Cycles convex_hull >>