- 浏览: 85284 次
文章分类
最新评论
-
bailangfei3344:
自我介绍 -
regionwar:
你好,转化为人为:1、不该加锁的不要加锁:局部变量,单线程占用 ...
关于java锁机制的优化 -
danni505:
希望能交流:
msn:danni-505#hotmail.co ...
关于java锁机制的优化 -
ouspec:
收藏的东西不错。
TOP500 -
willpower:
The idea behind is e-sync IO do ...
Rethink the sync
1. adjacent matrix
good for border scan, bad for space O(n*n), spare matrix mostly
java 代码
- public class GraphMatrix {
- private int[][] nodeMatrix;
- private int matrixSize;
- public GraphMatrix(int matrixSize) {
- this.matrixSize = matrixSize;
- nodeMatrix = new int[matrixSize][matrixSize];
- init();
- }
- private void init() {
- for (int i=0; i
- for (int j=0; j
- nodeMatrix[i][j] = 0;
- }
- }
- }
- public boolean addBorder(int startNode, int endNode) {
- if (hasBorder(startNode, endNode)) {
- System.err.println("already has a border!!!");
- return false;
- }
- nodeMatrix[startNode][endNode] = 1;
- return true;
- }
- public boolean hasBorder(int startNode, int endNode) {
- if (nodeMatrix[startNode][endNode] == 1) {
- return true;
- }
- return false;
- }
- public boolean deleteBorder(int startNode, int endNode) {
- if (!hasBorder(startNode, endNode)) {
- System.err.println("no this border!!!");
- return false;
- }
- nodeMatrix[startNode][endNode] = 0;
- return true;
- }
- }
2. adjacent table/vector
good for space, bad for border scan
java 代码
- import java.util.Vector;
- public class GraphTable {
- class Node {
- Vector adjacentNodes = new Vector();
- public void add(Node node) {
- if (!hasNode(node)) {
- adjacentNodes.add(node);
- }
- }
- public boolean hasNode(Node node) {
- return adjacentNodes.contains(node);
- }
- public void delete(Node node) {
- if (hasNode(node)) {
- adjacentNodes.remove(node);
- }
- }
- }
- private Node[] nodeTable;
- private int tableSize;
- public GraphTable(int tableSize) {
- this.tableSize = tableSize;
- nodeTable = new Node[tableSize];
- init();
- }
- private void init() {
- for (int i=0; i
- nodeTable[i] = new Node();
- }
- }
- public void addBorder(int fromNode, int desNode) {
- nodeTable[desNode].add(nodeTable[fromNode]);
- }
- public void deleteBorder(int desNode, int deleteNode) {
- nodeTable[desNode].delete(nodeTable[deleteNode]);
- }
- public boolean hasBorder(int fromNode, int toNode) {
- return nodeTable[fromNode].hasNode(nodeTable[toNode]);
- }
- }
3. incident matrix
n/a
发表评论
-
字符编码笔记:ASCII,Unicode和UTF-8 (引用)
2009-01-07 10:39 936字符编码笔记:ASCII,Unicode和UTF-8 阮一峰 ... -
How to set up a simple LRU cache using LinkedHash
2008-11-03 18:05 1283How to set up a simple LRU cach ... -
Scalability?
2008-10-07 14:07 833严格上讲,scalability还没有正式定义, 甚至有人觉得 ... -
Cray Reminiscences
2007-08-29 15:54 798Kirk Pepperdine's attendence of ... -
lock-free
2007-06-18 22:06 9951. http://www.ibm.com/developer ... -
解决java.lang.OutOfMemoryError: PermGen space(转帖)
2007-06-05 18:07 3163解决方案就是:在启动服务器时加上指定PermGen区域的内存大 ... -
Performance...
2007-06-05 15:11 983« I used to work for... | Mai ... -
数据仓库
2007-04-18 10:38 1122... -
Expressions Transform
2007-04-13 11:13 1397Expressions, Conversion and Eva ... -
Java cleanup code
2007-04-03 12:20 1297Java shutdown hook guarantee th ... -
Java performance tunning
2007-04-03 11:37 941http://www.javaperformancetunin ... -
Running IE from command line
2007-04-03 10:58 1117Here's a simple way you can ru ... -
Unicode and UTF8
2007-04-03 10:27 911What is Unicode? Unicode provid ... -
Daemon Thread Notes
2007-04-03 09:16 26521. 只要程式中的non-Daemon thread都結束了. ... -
How to know the main class of a jar file?
2007-04-02 15:18 1031Easy. Here is an implementation ... -
The best chinese BAT tutorial(from www.boofee.net/bigfee/)
2007-03-27 11:58 1329如何创建批处理文件? 不要听了批处理文件就感到很神气 ... -
Basics - Binary search
2007-03-26 15:53 979java 代码 public class Bin ... -
MergeSort
2007-03-23 17:26 855MergeSort is a sample solutio ... -
Functional Programming For The Rest of Us
2007-03-23 10:39 1305I like connect beautiful artic ... -
Functional Programming For The Rest of Us
2007-03-23 10:24 1063I like connect beautiful artic ...
相关推荐
GRAPH DATA STRUCTURE 27. Graphs 28. Depth First Traversal 29. Breadth First Traversal TREE DATA STRUCTURE 30. Tree 31. Tree Traversal 32. Binary Search Tree 33. AVL Trees 34. Spanning Tree 35. Heaps ...
图数据结构 具有。 该库提供了有向图数据结构的... var Graph = require ( "graph-data-structure" ) ; 例子 美国广播公司 要创建图实例,请调用Graph作为构造函数。 var graph = Graph ( ) ; 使用addNode和addE
You’ll explore graph theory, the graph data structure, and GraphQL types before learning hands-on how to build a schema for a photo-sharing application. This book also introduces you to Apollo Client...
You’ll explore graph theory, the graph data structure, and GraphQL types before learning hands-on how to build a schema for a photo-sharing application. This book also introduces you to Apollo Client...
"Data Structure Visualizations.zip" 文件提供了一个离线版的数据结构可视化学习资源,让你无需网络连接即可在本地探索和理解各种数据结构。 1. **数组(Array)**:数组是最基础的数据结构,它将元素按照特定顺序...
A web component to represent a graph data structure in a 3-dimensional space using a force-directed iterative layout. Uses ThreeJS/WebGL for 3D rendering and either d3-force-3d or ngraph for the ...
Graph data structure Strongly Connected Components(SCC) Prim's minimum spanning tree Kruskal MST Directed/Undirected graph ops Breadth First Search Depth First Search Dijkstra's algorithm Bellman-Ford...
Data structure 1 Linked data structure 3 Succinct data structure 6 Implicit data structure 8 Compressed data structure 9 Search data structure 10 Persistent data structure 11 Concurrent data structure...
在IT领域,图数据结构(Graph Data Structure)是一种非常重要的抽象数据类型(ADT,Abstract Data Type)。图是由节点(也称为顶点)和边组成的集合,用于表示对象之间的关系。在C语言中实现图的ADT可以帮助我们...
在Python-Implementation-of-Algorithms-and-Data-Structures-and-Leetcode-Solutions-master这个项目中,你可以找到作者对这些算法和数据结构的实际代码实现,这对于学习和实践是非常宝贵的资源。通过阅读和理解...
Data Structure Summary: Time Complexity & Space Complexity O(1) O(n) O(log(n)) o(n log(n))... Data Structures Performance Sorting Algorithms Performance Graph Operations Performance Heap Operations ...
2. **图数据结构(Graph Data Structure)**:用于存储地图的信息,包括节点间的连接和代价。 3. **A*搜索算法(Astar Search)**:主要包含主循环,用于从开放列表中选择下一个节点,更新节点状态,并将相邻节点...
Python数据结构中文版是针对想要深入理解数据结构的Python程序员所设计的一份宝贵资源。它以Python语言为载体,...阅读《python-data-structure-cn》这本书,将有助于读者更好地掌握这些概念,并将其应用到实际编程中。
5.5 Graph data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 5.6 Mesh data structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...
Graph neural networks (GNNs) are proposed to combine the feature information and the graph structure to learn better representations on graphs via feature propagation and aggregation. Due to its ...
- **其他静态图模式**:如社团结构(community structure),指的是图中的节点倾向于形成密集连接的小群体。 - **动态图中的模式**:随着时间和环境的变化,图的结构也会发生变化,研究这些变化对于理解社会网络、...
"Data_Structure_with_Python-master.zip"这个压缩包显然包含了关于如何使用Python实现各种数据结构和算法的教程或代码库。现在,我们将深入探讨这些核心概念。 数据结构是组织、存储和处理数据的方式。它们提供了...
在这个“data-structure--Graph.zip”压缩包中,我们可以期待找到关于图的各种算法和实现的代码示例。 图是由顶点(Vertex)和边(Edge)构成的非线性数据结构,可以用来表示对象之间的关系。在图中,顶点可以代表...
数据结构与算法,C描述。第二版,英文讲义PPT。...chapter6 General trees,chapter7 Sorting,chapter8 Primary & Secondary Storage,Chapter-9 Search,chapter11 Graph,chapter13 Advanced Trees Structures