------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 199x by International Computer Science Institute            --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------

abstract class $RO_UGRAPH{NTP} < $GRAPH{NTP,UEDGE{NTP}} is
   -- Undirected graphs. NTP indicates the type of the node index
   -- which is used internally by a graph implementation to access
   -- its
   -- 
   -- Since there is no valid subtyping relationship between ugraphs
   -- and digraphs (neither is a proper subtype of the other) and due
   -- to the subtle relationships between them, there is no subtyping
   -- relationship between directed and undirected graphs.  We (will)
   -- provide explicit conversion methods and adaptor "views" to see a
   -- digraph as an undirected graph and vice versa

   copy: $RO_UGRAPH{NTP};
   -- Return a copy of the graph
   
   equals(g: $RO_UGRAPH{NTP}): BOOL;
   -- Return true if self = "g" i.e. if all the nodes and edges are equal 
   -- (by is_eq)
   
end;
-------------------------------------------------------------------
abstract class $UGRAPH{NTP} < $RO_UGRAPH{NTP} is
   -- A modifiable undirected graph. It has edges of type UEDGE{NTP},
   -- which are simply unordered pairs of nodes
   
   add_node: NTP;
   -- Add a node to the graph and return the node index, which is an
   -- internal reference to the node (used within the graph implementation)
   
   add_node(n: NTP): NTP;
   -- Add a node to the graph and return the new node index, which is an
   -- internal reference to the node (used within the graph implementation)
   -- The node that is returned may or may not be the same as the node
   -- "n" that is passed in as an argument.

   connect(e: UEDGE{NTP});
   -- Connect the nodes specified by edge "e". i.e. create an edge
   -- between e.first and e.second
   -- Usage: g: DIGRAPH{INT} := #;
   --    n3 ::= g.add_node; 
   --    n4 ::= g.add_node;
   --    g.connect(#DIEDGE{INT}(n3,n4));
   -- Note that UGRAPH_INCL has wrappers to allow you to write g.connect(n3,n4);
   
   delete_node(n: NTP);
   -- Delete the node "n" from the graph, and any associated edges

   disconnect(e: UEDGE{NTP});
   -- Remove the edge "e" from the graph, from between nodes 
   -- e.first and e.second
   

end;
-------------------------------------------------------------------   

