Пример #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)