Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8562735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:47:42+00:00 2026-06-11T16:47:42+00:00

I am looking for a Python implementation of an algorithm which performs the following

  • 0

I am looking for a Python implementation of an algorithm which performs the following task:

Given two directed graphs, that may contain cycles, and their roots,
produce a score to the two graphs’ similarity.

(The way that Python’s difflib can perform for two sequences)

Hopefully, such an implementation exists. Otherwise, I’ll try and implement an algorithm myself. In which case, what’s the preferable algorithm to implement (with regard to simplicity).

The way the algorithm works is of no importance to me, though its’ complexity is.
Also, an algorithm which works with a different data-structure is also acceptable, as long as a graph, such as I described, can be represented with this DS.

I’ll emphasize, an implemetation would be much nicer.

Edit:
It seems an isomorphism algortihm is not relevant. It was suggested that graph edit distance is more to the point, which narrows down my search to a solution that either executes graph edit distance or reduces a graph to a tree and then performs tree edit distance.
The nodes themseleves consist of a few lines of assembly code each.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:47:43+00:00Added an answer on June 11, 2026 at 4:47 pm

    What we ended up doing is implementing an algorithm described in: “Heuristics for Chemical Compound Matching”.

    We’re using NetworkX for representing the grap and for finding the max clique.

    Edit:

    Basically, you create a new graph, each node (v) representing a possible pairing of a node from graph A (a) to a node from graph B (b).

    If in your application the two nodes (a,b) are either similar or not, you remove nodes (v) from the new graph which correspond to dissimilar pairings (a,b).
    You connect two nodes with an edge if they don’t contradict each other.
    For example, the pairings (a,b) and (a,c) contradict each other (see article for a formal definition).
    You then find a clique in the new graph which has the maximum amount of nodes.

    If in your application the two nodes’ similarity is not binary, you give the new nodes weights within a range (say (0,1)).
    You can remove, heuristically, remove new nodes with similarity grades lower than a predefined threshold.
    You then find a clique in the new graph which has the maximum weight (the sum of the nodes’ assigned weights).

    Either way, you finish up by generating the similarity grade: the size / total weight of the clique divided by a function of the attributes of the original graphs (maximum/minimum/average of the sizes / weights of A and B ).

    A nice feature is that the you can deduce the “source” of the similarity from the clique you found – the “stronger” pairings.

    Further clarification:
    The constraints are application dependent. We used the approach to compare pairs of function control-flow graphs. Generally, the approach finds a matching of some nodes in the first graph to some nodes in the second graph (subgraph to subgraph). Each node in the association graph symbolizes a possible matching of a single node from the first graph to a single node in the second graph. Since eventually a clique (a subset of the nodes) is selected, an edge means two matchings don’t contradict each other. To apply for a different application, you should ask what are the criteria for possible pairings (or what nodes do I create), and how does selecting one pairing influence the selection of another pairing (or how do I connect the nodes with edges).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a Ruby or Python implementation of the Git client that can
I'm looking for a decent implementation of the OPTICS algorithm in Python. I will
I have been looking without much luck for an implementation of Python that converts
I am looking for Python implementation of k-means algorithm with examples to cluster and
I'm looking for an implementation of s-t cut algorithm for flow network (directed graph)
I was looking at Python: Exception in the separated module works wrong which uses
I am looking for python stubbing library. Something that could be used to create
I'm looking for a Python library that's suitable, with DOM access too. I don't
I am looking for a python SOAP 1.2 client but it seems that it
I am looking for a python module that will help me get rid of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.