COIN-OR::LEMON - Graph Library

Opened 10 years ago

Last modified 9 years ago

#189 new enhancement

Add the functionality of ItemSetTraits to the graphs

Reported by: Peter Kovacs Owned by: Balazs Dezso
Priority: major Milestone:
Component: core Version: hg main
Keywords: Cc:
Revision id:

Description

Maybe we could introduce the functionality of ItemSetTraits to the graph concepts and to the adaptors in order to have the followings for all graph types.

  • Graph::Map<T, Value>
  • Graph::It<T> or Graph::ItemIt<T>

Where T can be Node, Arc or Edge.

Change History (7)

comment:1 Changed 10 years ago by Alpar Juttner

Owner: changed from Alpar Juttner to Balazs Dezso

comment:2 Changed 10 years ago by Balazs Dezso

Milestone: LEMON 1.1 releaseLEMON 1.2 release

comment:3 Changed 9 years ago by Peter Kovacs

Similar problem arises for functions, too. E.g. there are

      Node fromId(int, Node) const
      Edge fromId(int, Edge) const
      Arc fromId(int, Arc) const

      int maxId(Node) const
      int maxId(Edge) const
      int maxId(Arc) const

functions in the graph classes (with dummy parameters) to provide alternatives for nodeFromId(), maxNodeId() etc. functions. However the above functions are not documented, they are only used in internal tools (like ItemSetTraits).

If the above question of the ticket is solved, then these functions could also be replaced by template functions that are specialized for Node, Arc and Edge types.

      template <typename Item>
      Item fromId(int) const

      template <typename Item>
      int maxId() const

So e.g. maxId<Node>() could be used as an alternative to maxNodeId() (instead of maxId(Node()), which is a bit strange).

What do you think?

comment:4 Changed 9 years ago by Peter Kovacs

More similar functions are the different versions of notifier().

comment:5 in reply to:  3 ; Changed 9 years ago by Balazs Dezso

Replying to kpeter:

Similar problem arises for functions, too. E.g. there are

      Node fromId(int, Node) const
      Edge fromId(int, Edge) const
      Arc fromId(int, Arc) const

      int maxId(Node) const
      int maxId(Edge) const
      int maxId(Arc) const

functions in the graph classes (with dummy parameters) to provide alternatives for nodeFromId(), maxNodeId() etc. functions. However the above functions are not documented, they are only used in internal tools (like ItemSetTraits).

If the above question of the ticket is solved, then these functions could also be replaced by template functions that are specialized for Node, Arc and Edge types.

      template <typename Item>
      Item fromId(int) const

      template <typename Item>
      int maxId() const

So e.g. maxId<Node>() could be used as an alternative to maxNodeId() (instead of maxId(Node()), which is a bit strange).

What do you think?

It isn't a good idea, because the template specialization is forbidden in class space. The only solution would be if the specialized function was also declared out of the class, and this helper function would be called from the member function.

comment:6 in reply to:  5 Changed 9 years ago by Peter Kovacs

Replying to deba:

It isn't a good idea, because the template specialization is forbidden in class space.

Thanks, I didn't know that.

comment:7 Changed 9 years ago by Peter Kovacs

Milestone: LEMON 1.2 release
Note: See TracTickets for help on using tickets.