Skip to content

Updating topological grouping algorithm #125

@metincansiper

Description

@metincansiper

It has been a long time since I have implemented topology grouping feature in this repository.

  • I recognized that the algorithm I choose by that time is less efficient then I thought and also a few implementation mistakes I made makes it even less efficient
  • The other approach I considered but in a way ended up not implementing by that time is actually more efficient. The other approach I mentioned is basically is as below:
main()
  - maintain a hash table named as groupsTable
  - for each node:
    - Create a key by calling generateKey(node)
    - push the node to the groupsTable[key] (if groupsTable[key] is not existing initialize it with just this node)
  - Each key in the groupsTable represents a group so return the values of the table
 
generateKey(node)
  - maintain a string array 
  - for each edge of node
    -  Build a string that contains the other end of the edge, a divider ( _ ), an identifier representing the edge type, a divider ( _ ), a character representing the role of the other end in the edge (s for source, t for target, u if edge is undirected) 
    -  Push the string to the string array
  - Sort the string array
  - Join the elements of string array and return the result

One thing to consider here is that while generating the keys we need to make a sorting operation on a list whose size is the number of connections of a node. However, if we can assume that the number of connections of any node is upper bounded by the total number of the nodes in the graph then this approach must be more efficient than the other ones.

@ugurdogrusoz I can implement this in an availability of me and make a PR to the unstable branch if that would work for you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions