Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Graph.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:21 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/graph/graph/Graph.h,v $
00024                                                                         
00025                                                                         
00026 #ifndef Graph_h
00027 #define Graph_h
00028 
00029 // File: ~/graph/graph/Graph.h
00030 // 
00031 // Written: fmk 
00032 // Created: 11/96
00033 // Revision: A
00034 //
00035 // Description: This file contains the class definition for Graph.
00036 // The Graph class provides the abstraction of a graph, a collection of
00037 // vertices and edges. The Graph class is a container class which stores
00038 // and provides access to Vertex objects. The Vertices contain information 
00039 // about the edges in this design.
00040 //
00041 // What: "@(#) Graph.h, revA"
00042 
00043 #ifndef _bool_h
00044 #include "bool.h"
00045 #endif
00046 
00047 #include <iostream.h>
00048 
00049 #include <Vertex.h>
00050 #include <VertexIter.h>
00051 #include <TaggedObjectStorage.h>
00052 
00053 
00067 class Graph
00068 {
00069   public:
00075     Graph();
00076 
00082     Graph(int numVertices);    
00083 
00089     Graph(TaggedObjectStorage &theVerticesStorage);
00090 
00096     virtual ~Graph();
00097 
00098 
00108     virtual bool addVertex(Vertex *vertexPtr, bool checkAdjacency = true);
00109 
00120     virtual int addEdge(int vertexTag, int otherVertexTag);
00121 
00122     
00129     virtual Vertex *getVertexPtr(int vertexTag);
00130 
00135     virtual VertexIter &getVertices(void);
00136 
00141     virtual int getNumVertex(void) const;
00142 
00147     virtual int getNumEdge(void) const;
00148 
00158     virtual Vertex *removeVertex(int tag, bool removeEdgeFlag = true);
00159 
00160     
00165     virtual void Print(ostream &s, int flag =0);
00166 
00170     friend ostream &operator<<(ostream &s, Graph &M);    
00171 
00172     
00173   protected:
00174     
00175   private:
00177     TaggedObjectStorage *myVertices;
00178 
00180     VertexIter *theVertexIter;
00182     int numEdge;
00183 };
00184 
00185 #endif
00186 
Copyright Contact Us