i want to implement sparse graph in c\c++.
i need help regarding it.
is there any builtin sparse graph in STL?
or any kind of help that STL can provide regarding this?
any help will be highly appreciated.
:-)
i want to implement sparse graph in c\c++.
i need help regarding it.
is there any builtin sparse graph in STL?
or any kind of help that STL can provide regarding this?
any help will be highly appreciated.
:-)
C/C++ IDE: Microsoft visual studio .Net 2003
Wisdom is the reward for a lifetime of listening... when you'd have preferred to talk.
Not as such, but you can build one easily with the standard containers:is there any builtin sparse graph in STL?
Code:#include <iostream> #include <list> #include <vector> using namespace std; int main() { vector< list<int> > graph(7); /* Make this directed graph: 4 ------------->------+->-+ ^ | | | | | 5 ----->------+-> 6 <-+ | ^ | | | | | 0 ---> 1 ---> 2 --+-> 3 <-+ ^ ^ | | +-------<------+ | | +----------<----------+ */ graph[0].push_back(1); graph[1].push_back(2); graph[2].push_back(3); graph[2].push_back(6); graph[3].push_back(0); graph[3].push_back(1); graph[4].push_back(3); graph[4].push_back(6); graph[5].push_back(4); graph[5].push_back(6); graph[6].push_back(3); return 0; }
Just because I don't care doesn't mean I don't understand.