complexdb / zincbase Goto Github PK
View Code? Open in Web Editor NEWA state of the art knowledge base
License: MIT License
A state of the art knowledge base
License: MIT License
If you want to start a visualisation on zincbase.web,
you look up the code on basic.py.
Though it is very easy example I couldnt get the whole code because of missing comments.
Commenting would increase the developer experience on zincbase.
Hello!
I noticed that the graphing feature, by default, presents a networkx graph of the nodes and edges; however, the spacing can become a bit tight in the layout.
For either a feature enhancement or for anyone interested in spacing out the edges and nodes, consider the following modification to zb.py
# currently around line 829 and 830 ...
def plot(self, density=1.0):
"""Plots a network diagram from (triple) nodes and edges in the KB.
:param float density: Probability (0-1) that a given edge will be plotted, \
useful to thin out dense graphs for visualization."""
edgelist = [e for e in self.G.edges(data=True) if random.random() < density]
newg = nx.DiGraph(edgelist)
pos = nx.spring_layout(newg)
# ...
The code above leads to a dense plot as provided by plot1.png
Whereas the code below leads to some more spacing for the figure in plot2.png.
If changed to:
# code extract to demonstrate enhanced layout
def plot(self, density=1.0):
"""Plots a network diagram from (triple) nodes and edges in the KB.
:param float density: Probability (0-1) that a given edge will be plotted, \
useful to thin out dense graphs for visualization."""
edgelist = [e for e in self.G.edges(data=True) if random.random() < density]
newg = nx.DiGraph(edgelist)
# modification here!
# this creates some spacing to make tight clusters more readable and could be configured further with
# values for K and seed
pos = nx.spring_layout(newg, k=5 / math.sqrt(newg.order()), seed=0)
# ...
I cant find any documentation about zincbase.web.
I would appreciate if the module would be documented.
Hello, great library! I am making great use of it!
There is a slight issue with the plot() call to networkx.
In zb.py, around line 833, the script returns a networkx error when setting the parameter of font_size.
# line 833 of zb.py
nx.draw_networkx_edges(newg, pos, edgelist=edgelist, width=1, font_size=8)
The line of code above returns an error like the following:
TypeError: draw_networkx_edges() got an unexpected keyword argument 'font_size'
In my local, simply removing the font_size param from this call results in a successful networkx graph of my knowledge base.
# this works
nx.draw_networkx_edges(newg, pos, edgelist=edgelist, width=1)
I am not 100% sure, but based on the networkx function signature, it seems that the font_size param is not supported for draw edges.
Hi,
I stumbled upon module not found error in MacOS 10.14.3 (Mojave).
I have tried to install graph-tools in python3 and graph-tool deps via Homebrew.
❯ python3 examples/countries.py
Traceback (most recent call last):
File "examples/countries.py", line 8, in <module>
from zincbase import KB
File "/usr/local/lib/python3.7/site-packages/zincbase/__init__.py", line 1, in <module>
from .zincbase import KB
File "/usr/local/lib/python3.7/site-packages/zincbase/zincbase.py", line 20, in <module>
from graph import Node
ModuleNotFoundError: No module named 'graph'
Any idea how to make it work?
If I try to dump a medium complex kb with pickle, I get the exception
`'NoneType' object is not callable
A short google search shows me, that not every class can be dumped. It looks like
the knowledge base class should support this feature.`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.