SymPy
NetworkX
Our great sponsors
SymPy | NetworkX | |
---|---|---|
33 | 61 | |
12,008 | 14,070 | |
1.7% | 1.6% | |
10.0 | 9.6 | |
1 day ago | 1 day ago | |
Python | Python | |
GNU General Public License v3.0 or later | GNU General Public License v3.0 or later |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
SymPy
-
SymPy: Symbolic Mathematics in Python
A decade ago when I was interested in General Relativity I wanted to write a simple program to handle symbolic calculations for Einstein field equations (Starting with metric and calculated affine connections, ricci tensor …etc.). Sympy was an option (better because python was the only language I know well) but I found it hard and actually couldn't make it work. I used mathematica which was new for me but did it in a couple of hours. I expanded it later and used it to calculate a lot of things in a black hole paper I published later.
I checked now, and it seems that on this front a lot of development in sympy made it possible that we know how very good libraries built on top of it [1] [2]. There is even now a Jupyter notebook example on schwarzschild metric [3].
[1] https://docs.einsteinpy.org
[2]https://github.com/spacetimeengineer/spacetimeengine
[3] https://github.com/sympy/sympy/blob/master/examples/intermed...
Oldest commit was from today: https://github.com/sympy/sympy
Where are you getting 14 years from?
That's interesting. You should consider yourself lucky to have met Wolfram employees, as they are obviously vastly outnumbered by users of Mathematica.
I have not met any developers for either of these products but I know that SymPy has a huge list of contributors for a project of its size. See: https://github.com/sympy/sympy/blob/master/AUTHORS
You may not be hearing about SymPy users because SymPy is not a monolithic product. It is a library. If you know mathematicians big into using Python, they are probably aware of SymPy as it is the main attraction when it comes to symbolic computation in Python.
That's the newest commit. The oldest commit on GitHub is from 2007: https://github.com/sympy/sympy/commit/99b21ff58ad2e2ba831725...
-
Fast Symbolic Computation for Robotics
https://github.com/sympy/sympy/issues/9479 suggests that multivariate inequalities are still unsolved in SymPy, though it looks like https://github.com/sympy/sympy/pull/21687 was merged in August. This probably isn't yet implemented in C++ in SymForce yet?
-
Stem Formulas
https://news.ycombinator.com/item?id=36463580
From https://news.ycombinator.com/item?id=36159017 :
> sympy.utilities.lambdify.lambdify() https://github.com/sympy/sympy/blob/a76b02fcd3a8b7f79b3a88df... :
>> """Convert a SymPy expression into a function that allows for fast numeric evaluation [with the CPython math module, mpmath, NumPy, SciPy, CuPy, JAX, TensorFlow, SymPy, numexpr,]*
From https://westurner.github.io/hnlog/#comment-19084622 :
> "latex2sympy parses LaTeX math expressions and converts it into the equivalent SymPy form" and is now merged into SymPy master and callable with sympy.parsing.latex.parse_latex(). It requires antlr-python-runtime to be installed. https://github.com/augustt198/latex2sympy https://github.com/sympy/sympy/pull/13706
ENH: 'generate a Jupyter notebook' (nbformat .ipynb JSON) function from this stem formula
-
Vectorization: Introduction
https://en.wikipedia.org/wiki/Vectorization :
> Array programming, a style of computer programming where operations are applied to whole arrays instead of individual elements
> Automatic vectorization, a compiler optimization that transforms loops to vector operations
> Image tracing, the creation of vector from raster graphics
> Word embedding, mapping words to vectors, in natural language processing
> Vectorization (mathematics), a linear transformation which converts a matrix into a column vector
Vector (disambiguation) https://en.wikipedia.org/wiki/Vector
> Vector (mathematics and physics):
> Row and column vectors, single row or column matrices
> Vector space
> Vector field, a vector for each point
And then there are a number of CS usages of the word vector for 1D arrays.
Compute kernel: https://en.m.wikipedia.org/wiki/Compute_kernel
GPGPU > Vectorization, Stream Processing > Compute kernels: https://en.wikipedia.org/wiki/General-purpose_computing_on_g...
sympy.utilities.lambdify.lambdify() https://github.com/sympy/sympy/blob/a76b02fcd3a8b7f79b3a88df... :
> """Convert a SymPy expression into a function that allows for fast numeric evaluation [with the CPython math module, mpmath, NumPy, SciPy, CuPy, JAX, TensorFlow, SymPt, numexpr,]
pyorch lambdify PR, sympytorch: https://github.com/sympy/sympy/pull/20516#issuecomment-78428...
Sympytorch:
> Turn SymPy expressions into PyTorch Modules.
> SymPy floats (optionally) become trainable parameters. SymPy symbols are inputs to the Module.
sympy2jax https://github.com/MilesCranmer/sympy2jax :
> Turn SymPy expressions into parametrized, differentiable, vectorizable, JAX functions.
> All SymPy floats become trainable input parameters. SymPy symbols become columns of a passed matrix.
-
Has anyone solved the prime number problem on SPOJ yet using pure python?
Look at sympy.isprime for a carefully-optimized pure-Python solution (though if gmpy2 is installed, which it usually is, it will use that instead after trying the easiest cases)
- What can I contribute to SciPy (or other) with my pure math skill? I’m pen and paper mathematician
NetworkX
-
The Hunt for the Missing Data Type
I think one of the elements that author is missing here is that graphs are sparse matrices, and thus can be expressed with Linear Algebra. They mention adjacency matrices, but not sparse adjacency matrices, or incidence matrices (which can express muti and hypergraphs).
Linear Algebra is how almost all academic graph theory is expressed, and large chunks of machine learning and AI research are expressed in this language as well. There was recent thread here about PageRank and how it's really an eigenvector problem over a matrix, and the reality is, all graphs are matrices, they're typically sparse ones.
One question you might ask is, why would I do this? Why not just write my graph algorithms as a function that traverses nodes and edges? And one of the big answers is, parallelism. How are you going to do it? Fork a thread at each edge? Use a thread pool? What if you want to do it on CUDA too? Now you have many problems. How do you know how to efficiently schedule work? By treating graph traversal as a matrix multiplication, you just say Ax = b, and let the library figure it out on the specific hardware you want to target.
Here for example is a recent question on the NetworkX repo for how to find the boundary of a triangular mesh, it's one single line of GraphBLAS if you consider the graph as a matrix:
https://github.com/networkx/networkx/discussions/7326
This brings a very powerful language to the table, Linear Algebra. A language spoken by every scientist, engineer, mathematician and researcher on the planet. By treating graphs like matrices graph algorithms become expressible as mathematical formulas. For example, neural networks are graphs of adjacent layers, and the operation used to traverse from layer to layer is matrix multiplication. This generalizes to all matrices.
There is a lot of very new and powerful research and development going on around sparse graphs with linear algebra in the GraphBLAS API standard, and it's best reference implementation, SuiteSparse:GraphBLAS:
https://github.com/DrTimothyAldenDavis/GraphBLAS
SuiteSparse provides a highly optimized, parallel and CPU/GPU supported sparse Matrix Multiplication. This is relevant because traversing graph edges IS matrix multiplication when you realize that graphs are matrices.
Recently NetworkX has grown the ability to have different "graph engine" backends, and one of the first to be developed uses the python-graphblas library that binds to SuiteSparse. I'm not a directly contributor to that particular work but as I understand it there has been great results.
-
Build the dependency graph of your BigQuery pipelines at no cost: a Python implementation
In the project we used Python lib networkx and a DiGraph object (Direct Graph). To detect a table reference in a Query, we use sqlglot, a SQL parser (among other things) that works well with Bigquery.
- NetworkX – Network Analysis in Python
-
Google open-sources their graph mining library
For those wanting to play with graphs and ML I was browsing the arangodb docs recently and I saw that it includes integrations to various graph libraries and machine learning frameworks [1]. I also saw a few jupyter notebooks dealing with machine learning from graphs [2].
Integrations include:
* NetworkX -- https://networkx.org/
* DeepGraphLibrary -- https://www.dgl.ai/
* cuGraph (Rapids.ai Graph) -- https://docs.rapids.ai/api/cugraph/stable/
* PyG (PyTorch Geometric) -- https://pytorch-geometric.readthedocs.io/en/latest/
--
1: https://docs.arangodb.com/3.11/data-science/adapters/
2: https://github.com/arangodb/interactive_tutorials#machine-le...
-
org-roam-pygraph: Build a graph of your org-roam collection for use in Python
org-roam-ui is a great interactive visualization tool, but its main use is visualization. The hope of this library is that it could be part of a larger graph analysis pipeline. The demo provides an example graph visualization, but what you choose to do with the resulting graph certainly isn't limited to that. See for example networkx.
-
Network Graph Layer3 Topology
I had some success using Networkx in the past: https://networkx.org/
-
PageRank Algorithm for Graph Databases
Common graph databases are network-based for scaling purposes. Sqlite is a in-file database. So just run graph algorithms on a stringifed json stored as a text on sqlite.
See the networkx module for the common graph algorithms https://networkx.org/
-
NetworkX 3.0
A good place to start specifically for NetworkX would be to go through the new contributor documentation: https://networkx.org/documentation/latest/developer/new_cont...
We also have some structured projects https://networkx.org/documentation/latest/developer/projects... but they are usually for programs like GSoC/Outreachy.
Feel free to start a discussion https://github.com/networkx/networkx/discussions if you are looking for something specific :)
[I am one of the NetworkX devs]
A key feature of this release is pluggable backends incl gpu based ones which should greatly affect performance
-
-🎄- 2022 Day 12 Solutions -🎄-
Sure! I didn't actually use any path-finding algorithm -- I used networkx to do the pathfinding. Essentially, I created a directed graph in networkx which allowed me to model each location as a node and then place a directed edge between them if I was allowed to move from one to the next following the rules (wasn't jumping up more than one step at a time). Once I had built the map, I used the shortest_path_length command in networkx to find the shortest path and compute its length. Let me know if this makes sense or if you want more explanation!
What are some alternatives?
SciPy - SciPy library main repository
NumPy - The fundamental package for scientific computing with Python.
Numba - NumPy aware dynamic Python compiler using LLVM
Dask - Parallel computing with task scheduling
Pandas - Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
julia - The Julia Programming Language
RDKit - The official sources for the RDKit library
snap - Stanford Network Analysis Platform (SNAP) is a general purpose network analysis and graph mining library.
Interactive Parallel Computing with IPython - IPython Parallel: Interactive Parallel Computing in Python
networkit - NetworKit is a growing open-source toolkit for large-scale network analysis.
ti84-forth - A Forth implementation for the TI-84+ calculator.