Cached View
We have added a new function .cache_view
which builds a lightweight index of the nodes and edges present in the current view (i.e. when you have applied a window/layer filter etc). If you are running any global algorithms or analytical pipelines over views, this will make your analysis drastically faster!
Example:
g = Graph()
#add some updates
for windowed_graph in g.rolling("1 day"):
cached = windowed_graph.cache_view() #We are gonna run several algorithms, so build an index
rp.weakly_connected_components(cached)
rp.pagerank(cached)
Node and edge filter view
We have added new views for the filtering of Nodes and Edges based upon property values. This includes checking:
- if a property exists/doesn't exist
- if the property value is less than/greater than/equal to a give argument
- if the property value is in/not in a list of given arguments.
Note the edge filters are currently disabled for PersistentGraph
whilst we confirm there are no missing corner cases.
Python example:
from raphtory import Graph
g = Graph
# add some updates
graph.filter_edges(Prop("test_int") > 2)
graph.filter_exploded_edges(Prop("test_str") != "first")
graph.filter_nodes(Prop("node_bool").is_some())
graph.filter_nodes(Prop("node_int") in [2,2,4])
Graphql example:
graph(path: "g") {
nodes {
nodeFilter(
property: "prop1",
condition: {
operator: ANY,
value: [10, 30, 50, 70]
}
) {
list {
name
}
}
}
}
Create Node
Added a create_node
function which works exactly the same as add_node
but will fail if the node is already in the graph. This is mostly useful in Graphql, where it is harder to first check if a node exists, but has been exposed in python as well.
Example:
from raphtory import Graph
g = Graph()
g.create_node(1,1) #Returns fine
g.create_node(1,1) #Throws an exception
g.add_node(1,1) #Returns fine
Import as
Added a set of import_as
functions which allow renaming of nodes and edges when importing from one graph into another.
Example:
from raphtory import Graph
g1 = Graph()
a = g1.add_node(1, "A") #create node A in graph1
g2 = Graph()
g2.import_node_as(a, "X") # import A into graph2 as X - this brings all updates and properties as well
e = g1.add_edge(1,"A","B"") # add edge A->B to graph1
g2.import_edge_as(e,("X","Y")) #import edge A->B into graph2 as X->Y - this brings all updates and properties with it
Python
- When using the Property APIs with any numerical properties Raphtory will now return numpy arrays instead of python lists. This is better for memory usage, faster to hand over from rust, and means aggregations etc are a lot more straight forward.
- Exposed the secondary time index, allowing mangement of updates which occur at the same time.
- Changes
Graph.add_property
toGraph.add_properties
to bring it in line with other APIs. - Fixed a bug in the repr where we were print the wrong edge info (#1808)
- Added wrappers for constructing vecs from any python iterable, meaning
Nodes
andEdges
can be handed over toimport
functions directly without collecting.
Algorithms
- Added FastRP based on "Fast and Accurate Network Embeddings via Very Sparse Random Projection" by Haochen Chen, et al.
- Added maximum-weighted matching based on "Efficient Algorithms for Finding Maximum Matching in Graphs" by Zvi Galil, et al.
- Changed the return of in-component and out-component to include the distance from the starting node.
UI updates
- We have added a
Saved graphs
page which enables you to open whole graphs and get some top level statistics on each of the graphs on your server. An example of this can be seen below. - A whole heap of small bug fixes! We have noted several more (thank you everyone that is reporting them) and shall be blasting through them over the coming weeks before Christmas).
GraphQL
- Added the edge ID function which returns the names of the source and destination as an array.
- Added explode and eplode_layers onto the edges object.
- Added all node property filters to graphql - examples of these can be found here.
- Added the namespace function onto graph/graphql to allow easier grouping by path.
- Removes the ability to create RemoteGraph directly, can now only be done through the client
Core-Raphtory
- Made lazy node state support time ops and layer ops. This allows you to e.g. get a windowed degree for all nodes in the graph. This is a step towards out new NodeState APIs which should be complete soon.
- Exposed several low level APIs to make writing raphtory extensions easier.
- Subgraphs creation is now faster as we no longer need to build a hashset. Counting nodes should also be much faster now as well.
- Made the inner rust value accessible on python NodeState and LazyNodeState wrappers.
- Exposed parquet_loaders in rust.
- updated our pyo3 version for python bindings to the new APIs.
- Removed snmalloc as the build started to fail due to some unknown upstream dependency.
Python Documentation
- Drastically improved the stub generation for hints within python IDEs
- Fixed many missing types/doc strings, incorrect/confusing descriptions
- Added warning for missing docs (still some to fix, but will mean in future we can fix a lot quicker)
Datasets
- Added some properties to the LOTR data for the basic graphRAG example.
What's Changed
- Py speedup1 by @fabianmurariu in #1840
- install rustup + cargo when generating readthedocs by @fabianmurariu in #1846
- Fix existing rust Dockerfile by @ricopinazo in #1844
- Adding initial docker files by @miratepuffin in #1836
- fix docker by @shivam-880 in #1849
- fix docker release by @shivam-880 in #1851
- Fix/workflow by @shivam-880 in #1852
- Update/pyo3 by @ljeub-pometry in #1847
- Make load edges pub in parquet_loaders.rs by @Alnaimi- in #1843
- Node property filters by @ljeub-pometry in #1830
- Feature/graphqlfunctions by @rachchan in #1853
- remove snmalloc by @fabianmurariu in #1856
- max weight matching by @miratepuffin in #1602
- Feature/create node by @shivam-880 in #1855
- Update pull_request_template.md by @miratepuffin in #1858
- add wrapper for constructing vec from any python iterable by @ljeub-pometry in #1862
- Sparse Node temporal props by @fabianmurariu in #1848
- impl filters and tests by @shivam-880 in #1857
- Feature/node state ops by @ljeub-pometry in #1854
- Feature/import as by @shivam-880 in #1859
- impl edge id for graphql and add test by @shivam-880 in #1868
- add fast_rp algorithm by @wyatt-joyner-pometry in #1867
- Fix iconify icons by @ricopinazo in #1863
- improve subgraph count_nodes performance by @ljeub-pometry in #1869
- Add UI section to README.md by @Alnaimi- in #1872
- fix issue with edge repr multiple layer by @shivam-880 in #1870
- no reason to make a Hashset when building a subgraph anymore by @ljeub-pometry in #1874
- update graphql ui by @ricopinazo in #1876
- Various improvements for disk graph by @fabianmurariu in #1866
- Add distance from starting node for in- and out-components by @ljeub-pometry in #1877
- Features/py sec indices by @shivam-880 in #1875
- make the inner rust value accessible on python NodeState and LazyNodeState wrappers by @ljeub-pometry in #1878
- add lotr_graph_with_props function by @ricopinazo in #1881
- Feature/more public apis by @ljeub-pometry in #1879
- Fix stubs with make tidy before release by @miratepuffin in #1880
- Release v0.14.0 by @github-actions in #1865
- Disable auto docker publish by @miratepuffin in #1882
New Contributors
- @wyatt-joyner-pometry made their first contribution in #1867
Full Changelog: v0.13.1...v0.14.0