| 64 |
* SVG picture height - same as width, we need 1:1 side proportion! |
* SVG picture height - same as width, we need 1:1 side proportion! |
| 65 |
*/ |
*/ |
| 66 |
define('PIC_HEIGHT', PIC_WIDTH); |
define('PIC_HEIGHT', PIC_WIDTH); |
| 67 |
|
define('ROUTE_SHORTEST', 0); |
| 68 |
|
define('ROUTE_MIN_STEP', 1); |
| 69 |
/** |
/** |
| 70 |
* Performace tester helper function. Start a timer and measure the current memory usage |
* Performace tester helper function. Start a timer and measure the current memory usage |
| 71 |
* |
* |
| 114 |
* @return nickname The uid's drupal nickname |
* @return nickname The uid's drupal nickname |
| 115 |
*/ |
*/ |
| 116 |
function get_real_name($uid) { |
function get_real_name($uid) { |
| 117 |
$name_q = "SELECT name FROM users WHERE uid = %d"; |
$name_q = "SELECT name FROM {users} WHERE uid = %d"; |
| 118 |
$name = db_query($name_q, $uid); |
$name = db_query($name_q, $uid); |
| 119 |
$line = db_fetch_array($name); |
$line = db_fetch_array($name); |
| 120 |
return $line["name"]; |
return $line["name"]; |
| 126 |
* @return array All the users uid |
* @return array All the users uid |
| 127 |
*/ |
*/ |
| 128 |
function get_all_vertices() { |
function get_all_vertices() { |
| 129 |
$vertices_q = "SELECT uid FROM users WHERE status = 1"; |
$vertices_q = "SELECT uid FROM {users} WHERE status = 1"; |
| 130 |
$vertices = db_query($vertices_q); |
$vertices = db_query($vertices_q); |
| 131 |
while ($line = db_fetch_array($vertices)) { |
while ($line = db_fetch_array($vertices)) { |
| 132 |
$users[] = $line['uid']; |
$users[] = $line['uid']; |
| 140 |
* @return array All the users uid and name |
* @return array All the users uid and name |
| 141 |
*/ |
*/ |
| 142 |
function get_all_vertices_for_forms() { |
function get_all_vertices_for_forms() { |
| 143 |
$vertices_q = "SELECT uid, name FROM users WHERE status = 1"; |
$vertices_q = "SELECT uid, name FROM {users} WHERE status = 1"; |
| 144 |
$vertices = db_query($vertices_q); |
$vertices = db_query($vertices_q); |
| 145 |
while ($line = db_fetch_array($vertices)) { |
while ($line = db_fetch_array($vertices)) { |
| 146 |
$users[$line['uid']] = $line['name']; |
$users[$line['uid']] = $line['name']; |
| 297 |
* represents connection strength |
* represents connection strength |
| 298 |
* |
* |
| 299 |
* @param array $edges The adjacentcy list of the graph |
* @param array $edges The adjacentcy list of the graph |
| 300 |
* @return integer The length of the edge |
* @return array The strength of the minimum and the maximum edge |
| 301 |
*/ |
*/ |
| 302 |
function get_min_and_max_degree($edges) { |
function get_min_and_max_strength($edges) { |
|
static $cached_arr; |
|
| 303 |
$degrees = array(); |
$degrees = array(); |
| 304 |
if (is_array($cached_arr)) { |
foreach ($edges as $neighbours) { |
| 305 |
return $cached_arr; |
foreach ($neighbours as $degree) { |
| 306 |
} |
$degrees[] = $degree; |
|
else { |
|
|
foreach ($edges as $neighbours) { |
|
|
foreach ($neighbours as $degree) { |
|
|
$degrees[] = $degree; |
|
|
} |
|
| 307 |
} |
} |
|
sort($degrees); |
|
|
$cached_arr = array(reset($degrees), end($degrees)); |
|
|
return $cached_arr; |
|
| 308 |
} |
} |
| 309 |
|
sort($degrees); |
| 310 |
|
return array(reset($degrees), end($degrees)); |
| 311 |
} |
} |
| 312 |
|
|
| 313 |
/** |
/** |