랭킹으로 돌아가기

graphframes/graphframes

Scalagraphframes.io

GraphFrames is a package for Apache Spark which provides DataFrame-based Graphs

apache-sparkbig-dataconnected-componentsdataframedataframesgraphsnetwork-motifnetwork-motifsnetworkssparkpysparkgraph-algorithms
스타 성장
스타
1.2k
포크
268
주간 성장
이슈
37
5001k
2016년 2월2019년 7월2023년 1월2026년 7월
README

GraphFrames Logo

Scala CI Python CI pages-build-deployment scala-central-publish python-pypi-publish GitHub Release GitHub License PyPI - Downloads

GraphFrames: graph algorithms at scale

This is a package for graphs processing and analytics at scale. It is built on top of Apache Spark and relies on DataFrame abstraction. It provides built-in and easy to use distributed graph algorithms as well as flexible APIs like Pregel, AggregateMessages or AggregateNeighbors to make custom graph processing. Users can write highly expressive queries by leveraging the DataFrame API, combined with a new API for network motif finding. The user also benefits from DataFrame performance optimizations within the Spark SQL engine. GraphFrames works in Java, Scala, and Python.

GraphFrames usecases

There are some popular use cases when GraphFrames is almost irreplaceable, including, but not limited to:

  • Compliance analytics with a scalable shortest paths algorithm and motif analysis;
  • Anti-fraud with scalable cycles detection in large networks and by using K-Core algorithm;
  • Identity resolution at the scale of billions with highly efficient connected components;
  • Plan marketing campaigns in social networks using Maximal Independent Set algorithm;
  • Rank search result with a distributed, Pregel-based PageRank;
  • Cluster huge graphs with Label Propagation and Power Iteration Clustering;
  • Compute node embeddings at billion scale using Random-Walks and Hash2Vec model;
  • Build a knowledge graph systems with Property Graph Model.

Documentation

Quick Start

Now you can create a GraphFrame as follows.

from pyspark.sql import SparkSession
from graphframes import GraphFrame

spark = SparkSession.builder.getOrCreate()

nodes = [
    (1, "Alice", 30),
    (2, "Bob", 25),
    (3, "Charlie", 35)
]
nodes_df = spark.createDataFrame(nodes, ["id", "name", "age"])

edges = [
    (1, 2, "friend"),
    (2, 1, "friend"),
    (2, 3, "friend"),
    (3, 2, "enemy")  # eek!
]
edges_df = spark.createDataFrame(edges, ["src", "dst", "relationship"])

g = GraphFrame(nodes_df, edges_df)

Now let's run some graph algorithms at scale!

g.inDegrees.show()

# +---+--------+
# | id|inDegree|
# +---+--------+
# |  2|       2|
# |  1|       1|
# |  3|       1|
# +---+--------+

g.outDegrees.show()

# +---+---------+
# | id|outDegree|
# +---+---------+
# |  1|        1|
# |  2|        2|
# |  3|        1|
# +---+---------+

g.degrees.show()

# +---+------+
# | id|degree|
# +---+------+
# |  1|     2|
# |  2|     4|
# |  3|     2|
# +---+------+

g2 = g.pageRank(resetProbability=0.15, tol=0.01)
g2.vertices.show()

# +---+-------+---+------------------+
# | id|   name|age|          pagerank|
# +---+-------+---+------------------+
# |  1|  Alice| 30|0.7758750474847483|
# |  2|    Bob| 25|1.4482499050305027|
# |  3|Charlie| 35|0.7758750474847483|
# +---+-------+---+------------------+

# GraphFrames' most used feature...
# Connected components can do big data entity resolution on billions or even trillions of records!
# First connect records with a similarity metric, then run connectedComponents.
# This gives you groups of identical records, which you then link by same_as edges or merge into list-based master records.
sc.setCheckpointDir("/tmp/graphframes-example-connected-components")  # required by GraphFrames.connectedComponents
g.connectedComponents().show()

# +---+-------+---+---------+
# | id|   name|age|component|
# +---+-------+---+---------+
# |  1|  Alice| 30|        1|
# |  2|    Bob| 25|        1|
# |  3|Charlie| 35|        1|
# +---+-------+---+---------+

# Find frenemies with network motif finding! See how graph and relational queries are combined?
(
    g.find("(a)-[e]->(b); (b)-[e2]->(a)")
    .filter("e.relationship = 'friend' and e2.relationship = 'enemy'")
    .show()
)

# These are paths, which you can aggregate and count to find complex patterns.
# +------------+--------------+----------------+-------------+
# |           a|             e|               b|           e2|
# +------------+--------------+----------------+-------------+
# |{2, Bob, 25}|{2, 3, friend}|{3, Charlie, 35}|{3, 2, enemy}|
# +------------+--------------+----------------+-------------+

Learn GraphFrames

To learn more about GraphFrames, check out these resources:

GraphFrames tutorials

Community Resources

These resources are provided by the community:

GraphFrames Internals

Contributing

GraphFrames was made as a collaborative effort among UC Berkeley, MIT, Databricks and the open source community. At the moment GraphFrames is maintained by a group of individual contributors.

See contribution guide and the local development setup walkthrough for step-by-step instructions on preparing your environment, running tests, and submitting changes.

Releases

See release notes.

Star History

Star History Chart

관련 저장소
mlflow/mlflow

The open source AI engineering platform for agents, LLMs, and ML models. MLflow enables teams of all sizes to debug, evaluate, monitor, and optimize production-quality AI applications while controlling costs and managing access to models and data.

PythonPyPIApache License 2.0machine-learningai
mlflow.org
27.2k6k
treeverse/lakeFS

lakeFS - Data version control for your data lake | Git for data

GoGo ModulesApache License 2.0data-engineeringdata-versioning
docs.lakefs.io
5.5k466
microsoft/SynapseML

Simple and Distributed Machine Learning

ScalaMIT Licensesparkpyspark
aka.ms/spark
5.2k863
lw-lin/CoolplaySpark

酷玩 Spark: Spark 源代码解析、Spark 类库等

Scalasparkspark-streaming
3.5k1.4k
lakehq/sail

Drop-in Apache Spark replacement written in Rust, unifying batch processing, stream processing, and compute-intensive AI workloads.

Rustcrates.ioApache License 2.0arrowbig-data
lakesail.com
3.2k198
spark-notebook/spark-notebook

Interactive and Reactive Data Science using Scala and Spark.

JavaScriptnpmApache License 2.0apache-sparknotebook
3.1k642
kubeflow/spark-operator

Kubernetes operator for managing the lifecycle of Apache Spark applications on Kubernetes.

PythonPyPIApache License 2.0kuberneteskubernetes-operator
spark.kubeflow.org/en/latest/
3.1k1.5k
intel/BigDL

BigDL: Distributed TensorFlow, Keras and PyTorch on Apache Spark/Flink & Ray

Jupyter NotebookApache License 2.0apache-sparkdeep-neural-network
bigdl.readthedocs.io
2.7k730
intel-analytics/BigDL-2.x

BigDL: Distributed TensorFlow, Keras and PyTorch on Apache Spark/Flink & Ray

Jupyter Notebookapache-sparkdeep-neural-network
bigdl.readthedocs.io
2.7k733
dotnet/spark

.NET for Apache® Spark™ makes Apache Spark™ easily accessible to .NET developers.

C#MIT Licensesparkcsharp
dot.net/spark
2.1k333
big-data-europe/docker-spark

Apache Spark docker image

Shellspark-kuberneteskubernetes
2k687
feathr-ai/feathr

Feathr – A scalable, unified data and AI engineering platform for enterprise

ScalaApache License 2.0feature-engineeringfeature-store
join.slack.com/t/feathrai/shared_invite/zt-1ffva5u6v-voq0Us7bbKAw873cEzHOSg
1.9k245