Name

edges_data_structure — description of the data structure representing the edges of a graph

Description

A edges data structure is represented by a Scilab mlist with type edges and 4 fields:

  • tail row vector. tail(i) is the index of the node connected to the tail of the ith edge.

  • head row vector. head(i) is the index of the node connected to the head of the ith edge.

  • graphics> A Scilab mlist data structure of type egraphic which stores the information relative to edges graphical display (see egraphic_data_structure

  • data A Scilab mlist data structure of type edgedata. which stores the data associated with nodes. By defaut this data structure is empty. User can add its own fields using the add_edge_data function..

    For a given field the associated data should be a row vector or a matrix. In the matrix case a column is associated to an edge.

Examples


//create a simple graph
ta=[1  1 2 7 8 9 10 10 10 10 11 12 13 13];
he=[2 10 7 8 9 7  7 11 13 13 12 13  9 10];
g=make_graph('simple',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,'new')


g=add_edge_data(g,'length',round(10*rand(1,14,'u')));
g=add_edge_data(g,'label','e'+string(1:14));
edgedatafields(g)
g.edges.data
g.edges.data.label
g.edges.data(1:3)
g.edges.graphics.display='label';
show_graph(g)
g.edges.graphics.display='length';
show_graph(g)

 
  

See Also

graph_data_structure , add_edge , delete_arcs , edgedatafields , add_edge_data