longxi7997

图数据库Neo4j

图数据库Neo4j
2016-01-15 · 3 min read
Neo4j 图数据库

图数据库-Neo4j简介

在线演示地址

1、Neo4j的亮点

作为一款强健的,可伸缩的高性能数据库,Neo4j
最适合完整的企业部署或者用于一个轻量级项目中完整服务器的一个子集存在。
它包括如下几个显著特点:

完整的ACID支持:一个事务里面多个操作同时发生,保证数据一致性

高可用性:可靠,性能只受硬件影响,不受业务本身约束。

轻易拓展到上亿级别的节点和关系:可进行分布式集群部署

2、什么是图数据库

2.1 什么是图数据库

图数据库用图来存储数据,是最接近高性能的一种用于存储数据的数据结构方式之一。
  • 节点(Node):

    • labels、properties
  • 关系(Relationship):

    • types、properties、direction

    • can have relationhips to itself

    • relation toitself
    • relation to itself
    • types、properties、direction

    • key-value;key(null is valid),values(not null)

    • numeric、string、boolean

  • 标签(Label):

    • assign roles and types to nodes

    • when defining constraints and adding indexes for properties

    • can be added and removed during runtime, can be uesd to mark temporary
      states for your nodes

    • labes have an id space of a int - roughly 2 billion

    • Nodes andrelationships
    • Nodes and relationships
  • 遍历(Traversal):

    • in most cases only a subgraph is visited

    • Cypher provide a way to query the graph

    • depth-first( default ) 、 width-first

  • 路径(Path)

  • 模式(Schema)

    • schema commands can only be applied on the master machine in a Neo4j
      cluster
  • 索引(Index)

    • speed up queries

    • look at logs for clues to drop or recreate the index

    • you can use indexes through the different APIs,except Cypher

    • Neo4j use Constraints through different APIs to keep your data clean

2.2 对比其他数据库模型

  • a graph database transforms a RDBMS

    • RDBMS
RDBMS
Graph Database asRDBMS
Graph Database as RDBMS
  • a graph database elaborates a Key-Value store
Key-ValueStore
Key-Value Store
Graph Database as Key-ValueStore
Graph Database as Key-Value Store
  • a graph database relates Column-Family

    • Column Family(BigTable-style) databases are an evolution of key-value,
      using “families” to allow grouping of rows. Stored in a graph, the
      families could become hierarchical, and the relationships among data
      becomes explicit.
  • a graph database navigate a document store

    • The container hierarchy of a document database accommodates nice,
      schema-free data that can easily be represented as a tree. Which is of
      course a graph. Refer to other documents (or document elements) within
      that tree and you have a more expressive representation of the same
      data. When in Neo4j, those relationships are easily navigable.
    • DocumentStore
Document Store Store
Graph Database as DocumentStore
Graph Database as Document Store