abs_digraph.sa


Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
 
---------------------------> Sather 1.1 source file <--------------------------
-- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY and is
-- subject to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE
-- contained in the file: Sather/Doc/License of the Sather
-- distribution. The license is also available from ICSI, 1947 Center
-- St., Suite 600, Berkeley CA 94704, USA.
-- -------------------------------------------------------------------

abstract class $RO_DIGRAPH{NTP} < $GRAPH{NTP,DIEDGE{NTP}}

abstract class $RO_DIGRAPH{NTP} < $GRAPH{NTP,DIEDGE{NTP}} is -- NTP is the type of the node i.e. the type of the unique node -- index. This is a read-only digraph abstraction. No modifying -- operations are permitted. Most views of digraphs are of this -- type -- Inherits: -- size: INT; str: STR; has(n: NTP): BOOL; elt!: NTP; -- n_nodes:INT,n_edges:INT,n_adjacent(n: NTP): INT -- node!: NTP, edge!:DIEDGE{NTP}, adjacent!(n:NTP):NTP -- has_node(n: NTP):BOOL, has_edge(n:NTP):BOOL copy: $RO_DIGRAPH{NTP}; -- Create a copy of this digraph. The copy is also read-only n_incoming(n: NTP): INT; -- Return the number of incoming edges into the node "n" n_outgoing(n: NTP): INT; -- Return the number of outgoing edges from the node "n" -- ------ Cursor -------------------------- incoming!(once n: NTP): NTP; -- Yield the incoming edges into the node "n". No ordering -- is guaranteed outgoing!(once n: NTP): NTP; -- Yield the outgoing edges from the node "n" -- Equality testing equals(g: $RO_DIGRAPH{NTP}): BOOL; -- Return true if the self and "g" have the same structure and the -- same nodes. The nodes must be the *same* (i.e. =), and in -- both graphs the must be the same edges between nodes end;

abstract class $DIGRAPH{NTP} < $RO_DIGRAPH{NTP}

abstract class $DIGRAPH{NTP} < $RO_DIGRAPH{NTP} is -- A directed graph that permits the addition of new nodes and edges. add_node: NTP; -- Add a new node to the graph. Returns the node index add_node(n: NTP): NTP; -- Add the node "n" to the graph. Return a node index. The node -- index that is returned may be the same as the original node -- index, if that is appropriate for this graph, or maybe a new -- object. The user of this function should make no assumption -- about the relationship between the node that is added and the -- index that is returned. connect(e: DIEDGE{NTP}); -- Add the edge "e" which connects the nodes "e.first" to -- "e.second" delete_node(n: NTP); -- Delete the node index "n" disconnect(e: DIEDGE{NTP}); -- Delete the edge specified by "e". Does nothing if -- "e" does no exist end;