<< line_graph Graphes - Réseaux max_clique >>

metanet >> metanet > Graphes - Réseaux > mat_2_graph

mat_2_graph

graphe à partir de matrice d'incidence sommets-arcs ou sommets-sommets

Séquence d'appel

g = mat_2_graph(a,oriented,[mat])

Paramètres

a

matrice creuse d'incidence sommets-arcs ou sommets-sommets

orienté

entier, 0 (graphe non-orienté ) ou 1 (graphe orienté)

mat

chaîne optionnelle, 'node-arc' ou'node-node'

g

graphe (liste)

Description

mat_2_graph calcule le graphe g correspondant à la matrice creuse d'incidence sommets-arcs ou sommets-sommets a. Vérification est faite que a est une matrice d'incidence sommets-arcs ou sommets-sommets d'un graphe orienté (orienté = 1) ou non-orienté (non-orienté = 0). Si l'argument optionnel mat est omis ou est la chaîne de caractères 'node-arc', a doit être une matrice sommets-arcs. Si mat est la chaîne de caractères 'node-node', a doit être une matrice sommets-sommets.

Exemples

// creation d'un graphe orienté avec 13 noeuds et 14 arcs.
ta=[1  1 2 7 8 9 10 10 10 11 12 13 13];
he=[2 10 7 8 9 7  7 11 13 12 13  9 10];
g=make_graph('foo',1,13,ta,he);
g.nodes.graphics.x=[40,33,29,63,146,233,75,42,114,156,237,260,159]
g.nodes.graphics.y=[7,61,103,142,145,143,43,120,145,18,36,107,107]
show_graph(g)

a=graph_2_mat(g);
g1=mat_2_graph(a,1);
g1.nodes.graphics.x=g.nodes.graphics.x; g1.nodes.graphics.y=g.nodes.graphics.y;
show_graph(g1,'new');

a=graph_2_mat(g,'node-node');
g1=mat_2_graph(a,1,'node-node');
g1.nodes.graphics.x=g.nodes.graphics.x; g1.nodes.graphics.y=g.nodes.graphics.y;
show_graph(g1,'new');

Voir Aussi


Report an issue
<< line_graph Graphes - Réseaux max_clique >>