File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
import unittest
2
2
import time
3
3
from pydatastructs .graphs import Graph
4
+ from pydatastructs .utils import AdjacencyListGraphNode , AdjacencyMatrixGraphNode
4
5
5
6
class TestGraphSnapshots (unittest .TestCase ):
6
7
def test_snapshot_creation (self ):
7
8
graph = Graph (implementation = 'adjacency_list' )
8
- graph .add_vertex ("A" )
9
- graph .add_vertex ("B" )
9
+ graph .add_vertex (AdjacencyListGraphNode ( "A" ) )
10
+ graph .add_vertex (AdjacencyListGraphNode ( "B" ) )
10
11
graph .add_edge ("A" , "B" , cost = 5 )
11
12
graph .add_snapshot ()
12
13
13
14
self .assertEqual (len (graph .list_snapshots ()), 1 )
14
15
15
16
def test_snapshot_retrieval (self ):
16
17
graph = Graph (implementation = 'adjacency_list' )
17
- graph .add_vertex ("A" )
18
- graph .add_vertex ("B" )
18
+ graph .add_vertex (AdjacencyListGraphNode ( "A" ) )
19
+ graph .add_vertex (AdjacencyListGraphNode ( "B" ) )
19
20
graph .add_edge ("A" , "B" , cost = 5 )
20
21
graph .add_snapshot ()
21
22
snapshot_time = graph .list_snapshots ()[0 ]
You can’t perform that action at this time.
0 commit comments