-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hamming Distance #893
Hamming Distance #893
Conversation
Maybe it is simpler and faster to not use numpy? e.g. (untested) def hd(G, H):
count = 0
for e in G.edges_iter():
if not H.has_edge(*e):
count+=1
for e in H.edges_iter():
if not G.has_edge(*e):
count+=1
return count |
That is probably better and it would equally work; sure! Actually, you d(positive, negative)>d(positive, non-positive)=d(negative, Any ideas? JC On Wed, Jun 26, 2013 at 11:58 AM, Aric Hagberg notifications@github.comwrote:
Johannes http://www.columbia.edu/~jac2130 "I can calculate the motions of the heavenly bodies, but not the madness of
|
…d graphs and a potentially different cost for non-relations and zero relations.
I made a pull request to your pull request with some format changes and file placement changes. Just for completeness the text of that pull request comment is: Hi JC, Finally, we will need some simple tests before merging. If you can come up with some simple graphs and compute correct values for them that's a good start--and maybe all the testing we need at first. You can create a test_hamming.py file in the tests directory inside algorithms (use test_cycles.py as an example if you want). Or if that's too much, just put the code for the tests in your hamming.py file after a line like: if name == "main": Thanks! |
Move hamming.py into algorithms and format docs for hamming_distance
…h the networkx conventions.
Dear networkx team, I have added a class named BayesNet, which inherits from your DiGraph class, as well as from Allan Downey's Joint class. This class is meant to represent a Bayes Net, which is both, a directed graph with causal interpretation of the directed edges and a joint distribution. Although, right now the code is far from ideal, I hope that it may be of use to you and others! |
@jac2130 even if they did accept your code, the checks have failed. |
I'll go ahead and close this PR, this hasn't been touched in a long time and the code bits from BayesNet can't go in NetworkX as it's GPL. @jac2130 I have created a new draft PR #5653 with only the new distances and made some changes to make it work with main branch of NX (it's not really tested) but feel free to pick it up from there if you interested in getting this in NetworkX 🎉 |
I added a file that calculates the simple Hamming Distance between two (possibly directed) graphs.