Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(15)  |  Call(10)  |  Derive(0)  |  Import(5)
Simple class for storing edge weights.

Use EdgeWeight[(u,v)] for access, undirected graphs are
handled properly. 

src/g/a/Gato-1.1.2/ObjectGred.py   Gato(Download)
import GatoGlobals # Needed for help viewer.XXX
from ObjectGraph import ObjectGraph, VertexObject, EdgeObject
from DataStructures import EdgeWeight, VertexWeight
from GraphUtil import OpenCATBoxGraph, OpenGMLGraph, OpenDotGraph, SaveCATBoxGraph, WeightedGraphInformer
from GraphEditor import GraphEditor
        else:
            if 2 not in k:
                self.G.edgeWeights[2] = EdgeWeight(self.G, initialWeight)  
                if self.G.edgeWeights[0].QInteger():
                    self.G.edgeWeights[2].Integerize()
        else:
            if 1 not in k:
                self.G.edgeWeights[1] = EdgeWeight(self.G, initialWeight)  
                if self.G.edgeWeights[0].QInteger():
                    self.G.edgeWeights[1].Integerize()

src/g/a/Gato-1.1.2/Gred.py   Gato(Download)
#GatoGlobals.AnimationParameters.cEdgeDefault = GatoGlobals.AnimationParameters.cEditorEdgeDefault
from Graph import Graph
from DataStructures import EdgeWeight, VertexWeight
from GraphUtil import OpenCATBoxGraph, OpenGMLGraph, OpenDotGraph, SaveCATBoxGraph, WeightedGraphInformer
from GraphEditor import GraphEditor
        else:
            if 2 not in k:
                self.G.edgeWeights[2] = EdgeWeight(self.G, initialWeight)  
                if self.G.edgeWeights[0].QInteger():
                    self.G.edgeWeights[2].Integerize()
        else:
            if 1 not in k:
                self.G.edgeWeights[1] = EdgeWeight(self.G, initialWeight)  
                if self.G.edgeWeights[0].QInteger():
                    self.G.edgeWeights[1].Integerize()

src/g/a/Gato-1.1.2/GraphUtil.py   Gato(Download)
from GatoGlobals import *
import Graph
from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight, VertexWeight, Queue
import logging
log = logging.getLogger("Gato")
    G = Graph.Graph()
    E = VertexLabeling()
    W = EdgeWeight(G)
    L = VertexLabeling()
 
            nrOfVertexWeights = eval(split(splitLine[5],':')[1])
            for i in xrange(nrOfEdgeWeights):
                G.edgeWeights[i] = EdgeWeight(G)
            for i in xrange(nrOfVertexWeights):
                G.vertexWeights[i] = VertexWeight(G)
    G.directed = 0
    E = VertexLabeling()
    W = EdgeWeight(G)
    L = VertexLabeling()
    VLabel = VertexLabeling()
                    G.AddEdge(s,t)
                    ELabel[(s,t)] = eval(d['label'])
                    W[(s,t)] = 0
                except:
                    d = None 

src/g/a/Gato-1.1.2/Graph.py   Gato(Download)
 
from GatoGlobals import *
from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight
import GraphUtil #import ConnectedComponents, FindBipartitePartitions 
 
        self.labeling         = VertexLabeling() # Names of vertices
        self.edgeWeights      = {}   # Dictionary of edge labellings
        self.edgeWeights[0]   = EdgeWeight(self)
        self.vertexWeights    = {}   # None by default
        self.size             = 0

src/g/a/Gato-1.1.2/ObjectGraph.py   Gato(Download)
 
from GatoGlobals import *
from DataStructures import Point2D, VertexLabeling, EdgeLabeling, EdgeWeight
#from math import log
 
 
        self.edgeWeights      = {}   # Dictionary of edge labellings
        self.edgeWeights[0]   = EdgeWeight(self)
        self.vertexWeights    = {}   # None by default
        self.size             = 0