- 浏览: 80825 次
文章分类
最新评论
-
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 875字符编码笔记:ASCII,Unicode和UTF-8 阮一峰 ... -
How to set up a simple LRU cache using LinkedHash
2008-11-03 18:05 1231How to set up a simple LRU cach ... -
Scalability?
2008-10-07 14:07 761严格上讲,scalability还没有正式定义, 甚至有人觉得 ... -
Cray Reminiscences
2007-08-29 15:54 744Kirk Pepperdine's attendence of ... -
lock-free
2007-06-18 22:06 9501. http://www.ibm.com/developer ... -
解决java.lang.OutOfMemoryError: PermGen space(转帖)
2007-06-05 18:07 3105解决方案就是:在启动服务器时加上指定PermGen区域的内存大 ... -
Performance...
2007-06-05 15:11 914« I used to work for... | Mai ... -
数据仓库
2007-04-18 10:38 1051... -
Expressions Transform
2007-04-13 11:13 1325Expressions, Conversion and Eva ... -
Java cleanup code
2007-04-03 12:20 1252Java shutdown hook guarantee th ... -
Java performance tunning
2007-04-03 11:37 882http://www.javaperformancetunin ... -
Running IE from command line
2007-04-03 10:58 1058Here's a simple way you can ru ... -
Unicode and UTF8
2007-04-03 10:27 871What is Unicode? Unicode provid ... -
Daemon Thread Notes
2007-04-03 09:16 26111. 只要程式中的non-Daemon thread都結束了. ... -
How to know the main class of a jar file?
2007-04-02 15:18 965Easy. Here is an implementation ... -
The best chinese BAT tutorial(from www.boofee.net/bigfee/)
2007-03-27 11:58 1269如何创建批处理文件? 不要听了批处理文件就感到很神气 ... -
Basics - Binary search
2007-03-26 15:53 911java 代码 public class Bin ... -
MergeSort
2007-03-23 17:26 761MergeSort is a sample solutio ... -
Functional Programming For The Rest of Us
2007-03-23 10:39 901I like connect beautiful artic ... -
Functional Programming For The Rest of Us
2007-03-23 10:24 780I 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...
Combining knowledge with strategies, Data Structure Practice for Collegiate Programming Contests and Education presents the first comprehensive book on data structure in programming contests....
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...
1. Learn Graph Data Structure 2. Use the pre-installed SNAP on Kesci.com or inst
Python中的数据结构和算法 这个仓库是我的python算法和数据结构的实现。 为什么使用算法和DS? 两者对于从事机器学习研究和工程工作的人来说都很重要。 但是,最重要的原因是-很有趣!!!
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 ...
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 ...
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...
数据结构与算法,C描述。第二版,英文讲义PPT。...chapter6 General trees,chapter7 Sorting,chapter8 Primary & Secondary Storage,Chapter-9 Search,chapter11 Graph,chapter13 Advanced Trees Structures
Master the most common algorithms and data structures, and learn how to implement them ... Graph Algorithms Chapter 8. Performance and Algorithm Efficiency Chapter 9. Choosing the Perfect Algorithm
"Data Structures And Algorithms Made Easy: Data Structure And Algorithmic Puzzles" is a book that offers solutions to complex data structures and algorithms. There are multiple solutions for each ...
Supplying an overview of graph-based social media analysis, the book provides readers with a clear understanding of social media structure. It uses graph theory, particularly the algebraic description...
数据结构---图的代码实现。 参考和学习的上好资料。
This book covers all aspects related to working with Neo4j, including querying, indexing, modeling of graph data, testing, and deployment of your Neo4j applications, and also shows you the internal ...
Gain a better understanding of PHP arrays as a basic data structure and their hidden power ? Grasp how to analyze algorithms and the Big O Notation ? Implement linked lists, double linked lists, ...