00001 #ifndef __GRAPHEDGELIST_H__
00002 #define __GRAPHEDGELIST_H__
00003
00004 #pragma once
00005
00006 #include <iostream>
00007 #include <fstream>
00008 #include <vector>
00009
00010 class GraphEdgeList;
00011
00017 std::ostream& operator<< (std::ostream& out, const GraphEdgeList & graph);
00018
00024 std::istream& operator>> (std::istream& out, const GraphEdgeList & graph);
00025
00026 class GraphEdgeList {
00027
00028 private:
00029 unsigned int n;
00030
00031 std::vector< std::vector<std::pair<int,int> > > neighbours;
00032
00033 std::vector< std::pair< std::pair<int,int>, int> > edgeList;
00034
00035 public:
00040 inline GraphEdgeList(unsigned int n) :
00041 n(n)
00042 {
00043 neighbours.resize(n);
00044 }
00045
00050 inline unsigned int get_n() const {
00051 return n;
00052 }
00053
00059 inline std::vector< std::pair<int,int> > & get_neighbours(int nod) {
00060 return neighbours[nod];
00061 }
00062
00067 inline std::vector< std::pair< std::pair<int,int>, int> > get_edges() {
00068 return edgeList;
00069 }
00070
00071 friend std::ostream& operator<< (std::ostream& out, GraphEdgeList & graph);
00072 friend std::istream& operator>> (std::istream& in, GraphEdgeList & graph);
00073 };
00074
00075 #endif
00076