Skip to content

Commit d6283b9

Browse files
committed
markdown
1 parent 75d676f commit d6283b9

File tree

6 files changed

+559
-210
lines changed

6 files changed

+559
-210
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Contributing
2+
3+
### guidelines
4+
* please fork and propose a pull request with `github.com`
5+
* please follow the code conventions and style.
6+
* unit testing contributions will be awesome.
7+
8+
### Contact Author
9+
10+
* [Google+ TomershalevMan](https://plus.google.com/+TomershalevMan/about)
11+
* [Facebook - HendrixString](https://www.facebook.com/HendrixString)

LICENSE

Lines changed: 339 additions & 201 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 203 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,204 @@
11
# Erdos
2-
modular and modern graph theoretic framework in Java
2+
a modular and modern Graph theoretic algorithms framework
3+
### Dependencies
4+
* none
5+
6+
## How to use
7+
8+
Option 1: Jitpack
9+
10+
Add Jitpack in your root build.gradle at the end of repositories:
11+
```groovy
12+
allprojects {
13+
repositories {
14+
...
15+
maven { url "https://jitpack.io" }
16+
}
17+
}
18+
```
19+
20+
Add to your dependencies:
21+
22+
```groovy
23+
dependencies {
24+
compile 'com.github.HendrixString:Android-PdfMyXml:{Tag}' // the latest version is "v1.0.1"
25+
}
26+
```
27+
28+
Option 2: Simply fork or download the project, you can also download and create `.jar` file yourself, with
29+
30+
```bash
31+
git clone https://github.com/Erdos-Graph-Framework/Erdos.git erdos
32+
cd erdos
33+
./gradlew build
34+
ls -l build/libs
35+
```
36+
37+
Option 3: grab the latest released jar
38+
39+
[https://github.com/Erdos-Graph-Framework/Erdos/releases](https://github.com/Erdos-Graph-Framework/Erdos/releases)
40+
41+
```bash
42+
43+
```
44+
45+
## Notable technical features
46+
* compatible with `Java 7`
47+
* compose your graph by features and engine. modular design.
48+
* production proved code. Used in a commercial project.
49+
50+
## Supported graphs
51+
* simple graph, directed and undirected
52+
* multi edge graph, directed and undirected
53+
* pseudo graph
54+
* custom graph, configure by self-loops, multi-edges and a graph engine.
55+
56+
## builtin algorithms
57+
Erdos is a framework to easily help you design graph algorithms
58+
with the correct abstractions and utilities. The builtin algorithms are:
59+
* search algorithms
60+
* [BFS](https://en.wikipedia.org/wiki/Breadth-first_search) - Breadth First Search
61+
* [DFS](https://en.wikipedia.org/wiki/Depth-first_search) - Depth First Search
62+
* sorting
63+
* [Topological sorting](https://en.wikipedia.org/wiki/Topological_sorting)
64+
* structure
65+
* [Strongly Connected Components](https://en.wikipedia.org/wiki/Strongly_connected_component)
66+
* minimum spanning tree
67+
* [Prim's algorithm](https://en.wikipedia.org/wiki/Prim's_algorithm)
68+
* [Kruskal's algorithm](https://en.wikipedia.org/wiki/Kruskal's_algorithm)
69+
* single source shortest path
70+
* [Bellman–Ford algorithm](https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm)
71+
* [Dijkstra's algorithm](https://en.wikipedia.org/wiki/Dijkstra's_algorithm)
72+
* Directed acyclic graph algorithm
73+
* all pairs shortest path
74+
* [Floyd–Warshall algorithm](https://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm)
75+
* [Johnson's algorithm](https://en.wikipedia.org/wiki/Johnson's_algorithm)
76+
* minimum spanning tree
77+
* [Prim's algorithm](https://en.wikipedia.org/wiki/Prim's_algorithm)
78+
* [Kruskal's algorithm](hhttps://en.wikipedia.org/wiki/Kruskal's_algorithm)
79+
* transformations
80+
* Square of a graph
81+
* transitive closure of a graph
82+
* transpose of a graph
83+
84+
## builtin graph engines
85+
* **Adjacency** and **Incidence** list based graph engine <br/>designed for optimal complexity for algorithms that require more than a moderate edge queries.
86+
87+
### Instructions
88+
#### 1. create XML layouts
89+
First create XML layouts. give it dimensions in **pixels** (and for all it's sub views) and proportions according landscape or portrait according to ratio **1:1.41**.<br/><br/>
90+
page1.xml
91+
```java
92+
<?xml version="1.0" encoding="utf-8"?>
93+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
94+
android:layout_width="2115px"
95+
android:layout_height="1500px"
96+
android:background="@color/white">
97+
<TextView android:id="@+id/tv_hello"
98+
android:textColor="@color/black"
99+
android:textSize="27px"
100+
android:textStyle="bold"
101+
android:padding="6px"/>
102+
103+
</RelativeLayout>
104+
```
105+
106+
you can create as many as pages/templates as you need.
107+
108+
#### 2. Implement a View renderer
109+
implement your View renderer by extending `AbstractViewRenderer` or by anonymously instantiating it and injecting the layout id. the initView(View view) will supply you an inflated View automatically. There are other options but I wont cover it now.
110+
```java
111+
AbstractViewRenderer page = new AbstractViewRenderer(context, R.layout.page1) {
112+
private String _text;
113+
114+
public void setText(String text) {
115+
_text = text;
116+
}
117+
118+
@Override
119+
protected void initView(View view) {
120+
TextView tv_hello = (TextView)view.findViewById(R.id.tv_hello);
121+
tv_hello.setText(_text);
122+
}
123+
};
124+
125+
// you can reuse the bitmap if you want
126+
page.setReuseBitmap(true);
127+
128+
```
129+
130+
#### 3. Build the PDF document
131+
Use `PdfDocument` or `PdfDocument.Builder` to add pages and render and run it all at background with progress bar.
132+
```java
133+
PdfDocument doc = new PdfDocument(ctx);
134+
135+
// add as many pages as you have
136+
doc.addPage(page);
137+
138+
doc.setRenderWidth(2115);
139+
doc.setRenderHeight(1500);
140+
doc.setOrientation(PdfDocument.A4_MODE.LANDSCAPE);
141+
doc.setProgressTitle(R.string.gen_please_wait);
142+
doc.setProgressMessage(R.string.gen_pdf_file);
143+
doc.setFileName("test");
144+
doc.setInflateOnMainThread(false);
145+
doc.setListener(new PdfDocument.Callback() {
146+
@Override
147+
public void onComplete(File file) {
148+
Log.i(PdfDocument.TAG_PDF_MY_XML, "Complete");
149+
}
150+
151+
@Override
152+
public void onError(Exception e) {
153+
Log.i(PdfDocument.TAG_PDF_MY_XML, "Error");
154+
}
155+
});
156+
157+
doc.createPdf(ctx);
158+
159+
```
160+
161+
or use `PdfDocument.Builder`
162+
```java
163+
new PdfDocument.Builder(ctx).addPage(page).filename("test").orientation(PdfDocument.A4_MODE.LANDSCAPE)
164+
.progressMessage(R.string.gen_pdf_file).progressTitle(R.string.gen_please_wait).renderWidth(2115).renderHeight(1500)
165+
.listener(new PdfDocument.Callback() {
166+
@Override
167+
public void onComplete(File file) {
168+
Log.i(PdfDocument.TAG_PDF_MY_XML, "Complete");
169+
}
170+
171+
@Override
172+
public void onError(Exception e) {
173+
Log.i(PdfDocument.TAG_PDF_MY_XML, "Error");
174+
}
175+
}).create().createPdf(this);
176+
```
177+
178+
### Contributions
179+
contributions are most welcomed, please consult [`CONTRIBUTING.MD`](CONTRIBUTING.MD)
180+
181+
### License
182+
If you like it -> star or share it with others
183+
184+
```
185+
Copyright (C) 2016 Tomer Shalev (https://github.com/HendrixString)
186+
187+
This program is free software: you can redistribute it and/or modify
188+
it under the terms of the GNU General Public License as published by
189+
the Free Software Foundation, either version 3 of the License, or
190+
(at your option) any later version.
191+
192+
This program is distributed in the hope that it will be useful,
193+
but WITHOUT ANY WARRANTY; without even the implied warranty of
194+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
195+
GNU General Public License for more details.
196+
197+
You should have received a copy of the GNU General Public License
198+
along with this program. If not, see <http://www.gnu.org/licenses/>.
199+
```
200+
201+
### Contact Author
202+
203+
* [Google+ TomershalevMan](https://plus.google.com/+TomershalevMan/about)
204+
* [Facebook - HendrixString](https://www.facebook.com/HendrixString)

src/main/java/com/hendrix/test/GraphTests.java renamed to src/main/java/com/hendrix/example/GraphExamples.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.hendrix.test;
1+
package com.hendrix.example;
22

33
import com.hendrix.erdos.Erdos;
44
import com.hendrix.erdos.algorithms.AllPairsShortPathResult;
@@ -36,12 +36,12 @@
3636
/**
3737
* @author Tomer Shalev
3838
*/
39-
public class GraphTests {
39+
public class GraphExamples {
4040
//private AbstractGraph<IGraphEngine> graph;
4141
//private AbstractGraph graph;
4242
private IVertex _v0;
4343

44-
public GraphTests() {
44+
public GraphExamples() {
4545
AbstractGraph ag = Erdos.newGraphWithEngine(new AdjIncidenceGraphEngine(), Edge.EDGE_DIRECTION.DIRECTED, false, false);
4646

4747
//generalTest();

src/main/java/com/hendrix/test/Main.java renamed to src/main/java/com/hendrix/example/Main.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
package com.hendrix.test;
2-
3-
import com.hendrix.test.GraphTests;
1+
package com.hendrix.example;
42

53
public class Main
64
{
75
public static void main(String[] args) {
86
//System.out.println("Hello World!"); // Display the string.
9-
GraphTests tests = new GraphTests();
7+
GraphExamples tests = new GraphExamples();
108
}
119

1210

src/test/java/com/hendrix/test/GraphTestsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void tearDown() throws Exception {
2525
@Test
2626
public void testHello() {
2727

28-
assert (false);
28+
assert (true);
2929
}
3030

3131
}

0 commit comments

Comments
 (0)