1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
graph_2_mat Scilab Group Scilab function graph_2_mat
NAME
graph_2_mat - node-arc or node-node incidence matrix of a graph
CALLING SEQUENCE
a = graph_2_mat(g,mat)
PARAMETERS
g : graph list
mat
: optional string, 'node-arc' or 'node-node' matrix
a : sparse node-arc or node-node incidence matrix
DESCRIPTION
graph_2_mat computes the node-arc or the node-node incidence matrix
corresponding to the graph g. If the optional argument mat is omitted
or is the string 'node-arc', the node-arc matrix is computed. If mat is
the string 'node-node', the node-node matrix is computed. If n is the
number of nodes of the graph and m is the number of edges of the graph,
the node-arc matrix is a Scilab sparse matrix of size (n,m). It is
defined as follows. If the graph is directed: a(i,j) = +1 if node i is
the tail of arc j a(i,j) = -1 if node i is the head of arc j If the
graph is undirected: a(i,j) = 1 if node i is the tail or the head of arc
j If n is the number of nodes of the graph, the node-node matrix is a
Scilab sparse matrix of size (n,n). It is defined as follows: a(i,j) =
1 if there is an arc from node i to node j
EXAMPLE
g=load_graph(SCI+'/demos/metanet/colored');
a=graph_2_mat(g)
a=graph_2_mat(g,'node-node')
SEE ALSO
mat_2_graph
|