Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Graph weighted_vertices

by Herkum (Parson)
on Oct 15, 2009 at 22:05 UTC ( [id://801446]=perlquestion: print w/replies, xml ) Need Help??

Herkum has asked for the wisdom of the Perl Monks concerning the following question:

I was looking through Graph and came across a add_weighted_vertex call and I don't understand why you put a weight on a node?

Replies are listed 'Best First'.
Re: Graph weighted_vertices
by JavaFan (Canon) on Oct 15, 2009 at 23:24 UTC
    Very useful if the graph is a model of something. Latency time in a network graph. Travel time on a road network. Ticket price for airlines. A slight modification of Dijkstra algorithm gives you an efficient solution to find the fastest/cheapest/whatever path through the graph.

      Why would you put a weight on the node itself instead of the paths?

      Is it just a way of shortcut to adding a weight to an edge for every node or is intended to represent something else?

        In graph theorie nodes and edges are "dual". Whenever you have a graph with weighted nodes you can construct a corresponding "dual" graph with weighted edges, and vice versa. And all algorithms are equally transformable.

        So "why weighting nodes" has the same legitimation as asking "why weighting edges".

        It's just a matter of perspective.

        Cheers Rolf

        PS: Wikipedia restricts this to planar graphs !?! I'm too lazy to verify what normally happens after transposing the incidence matrix... it certainly works for lattices and they are seldom planar graphs.

        UPDATE: OK the duality for lattices is very different, from the graph perspective it's just mirroring at the horizontal axis. I'm quote rosted in this 8(

        Anyway at least for planar graphs weighting can be "dualized"!

        In all the uses I had of graph theory (because in biochemistry, steady state kinetic equations can be mapped into graph theory) they weighted edges. But JavFan is right. What is the graph is of a place where cities charges taxes to enter, regardless which road you come on? How would you model that?

        David.

        Could it be that the weight of the edge is a function of the weight of the nodes? (Just thinking out loud)


        ___________
        Eric Hodges
        Imagine three nodes (e.g. cities), A, B, C.
        A and B are connected by multiple paths. B and C have 1 path. A and C have one path. If the question is, given paths of equal length, which two adjacent cities are most important (population?), edge weighting is irrelevant.

        Edge weighting isn't bad, but remember edges are defined by two nodes- not 1- which can differentiate a problem definition.
Re: Graph weighted_vertices
by kennethk (Abbot) on Oct 15, 2009 at 22:51 UTC
    A little Google can provide a bunch of insight - vertex-weighted graph. In particular, the paper whose abstract is here indicates a clear application.
Re: Graph weighted_vertices
by Bloodnok (Vicar) on Oct 15, 2009 at 22:28 UTC
    I seem to recall (from an all too dim and distant past) that Petri Nets can be modelled as a directed graph with wieghted/labelled vertices.

    Update:

    Ah yes, here we are

    A user level that continues to overstate my experience :-))
Re: Graph weighted_vertices
by Corion (Patriarch) on Oct 15, 2009 at 22:22 UTC

    Maybe not all places are of equal importance?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://801446]
Approved by Corion
Front-paged by MidLifeXis
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-04-23 23:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found