예제 #1
0
 def add_edge(self, n1, n2=None):  
     n1 = normalize_token(n1)
     n2 = normalize_token(n2)
     if n2 is None:  
         if len(n1)==3:  
             n1,n2,x=n1 
         else:           
             n1,n2=n1        
     self.__rep.add_edge(self.__name, n1, n2)    
예제 #2
0
 def add_edge_attr(self, n1, n2, type, attr):  
     n1 = normalize_token(n1)
     n2 = normalize_token(n2)
     attr = normalize_token(attr)
     self.__rep.add_edge_attr(self.__name, n1, n2, type, attr)    
예제 #3
0
 def has_edge(self, n1, n2=None):
     n1 = normalize_token(n1)
     n2 = normalize_token(n2)
     return self.__rep.exists_edge(self.__name, n1, n2)        
예제 #4
0
 def add_node_attr(self, n, type, attr):
     n = normalize_token(n)
     attr = normalize_token(attr)
     if attr:
         attr = normalize_token(attr)
     self.__rep.add_node_attr(self.__name, n, type, attr)
예제 #5
0
 def del_node(self, n):
     n = normalize_token(n)
     self.__rep.delete_node(self.__name, n)
예제 #6
0
 def push(self, n):
     n = normalize_token(n)
     self.__rep.push(self.__name, n)
예제 #7
0
 def add_node(self, n):
     n = normalize_token(n)
     self.__rep.add_node(self.__name, n)
예제 #8
0
 def has_node(self, n):
     n = normalize_token(n)
     return self.__rep.exists_node(self.__name, n)    
예제 #9
0
 def has_node_attr(self, n, type, attr):
     n = normalize_token(n)
     return self.__rep.exists_node_attr(self.__name, n, type, attr)    
예제 #10
0
 def edges(self, n=None):
     n = normalize_token(n)
     return self.__rep.get_edges(self.__name, n)
예제 #11
0
 def edge_attrs(self, n1, n2=None):
     n1 = normalize_token(n1)        
     n2 = normalize_token(n2)
     return self.__rep.get_edge_attrs(self.__name, n1, n2)
예제 #12
0
 def node_attrs(self, n=None, type=None):
     n = normalize_token(n)
     return self.__rep.get_nodes_attrs(self.__name, n, type)
예제 #13
0
 def __contains__(self, n):
     n = normalize_token(n)
     return self.__rep.exists_node(self.__name, n)
예제 #14
0
 def unpop(self, n, type='LIFO'):
     n = normalize_token(n)
     return self.__rep.unpop(self.__name, n, type)
예제 #15
0
 def del_edge(self, n1, n2=None):
     n1 = normalize_token(n1)
     n2 = normalize_token(n2)
     if n2 is None:  
         n1,n2=n1   
     self.__rep.delete_edge(self.__name, n1, n2)
예제 #16
0
 def has_edge_attr(self, n1, n2, type, attr):
     n1 = normalize_token(n1)
     n2 = normalize_token(n2)
     return self.__rep.exists_edge_attr(self.__name, n1, n2, type, attr)    
예제 #17
0
 def neighbors(self, n):
     n = normalize_token(n)
     for edge in self.__rep.get_edges(self.__name, n):
         yield edge[1]
예제 #18
0
 def set_focus_node(self, node):
     self.__focus_node = normalize_token(node)