Uploaded image for project: 'Commons Sandbox'
  1. Commons Sandbox
  2. SANDBOX-345

Weighted as an interface with generic weight type

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • None
    • Graph

    Description

      Hello,

      after recent discussions on the mailing list ("[Graph] On graph weight type(s)") I am proposing a first patch to enable support for generic weights in the current implementation.
      Main changes include:

      • adding an interface Weighted<W> with method W getWeight()
      • modifying WeightedEdge, WeightedPath, WeightedGraph etc. to implement the new interface
      • changing the implemented algorithms (at the moment they all still require weights to be Double)
      • changing the DOT exporter (prints the weight as an attribute only if it is of type Double)
      • incidentally also fixing a small bug in the DOT exporter ('weight' was part of the label, now it is a proper attribute as documented in DOT language specs http://www.graphviz.org/content/attrs#dweight)

      This can be the first safe step to dig into different types and/or properties of weights.
      Please let me know if it looks good.

      Cheers,
      Claudio

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            simone.tripodi Simone Tripodi
            claudio.squarcella Claudio Squarcella
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment