Instagram Cheat Sheet

PDF Publication Title:

Instagram Cheat Sheet ( instagram-cheat-sheet )

Previous Page View | Next Page View | Return to Search List

Text from PDF Page: 165

6.3.6 Handling zero edge weights Matlab sparse matrices only store non-zero values. Because the structure of the Matlab sparse matrix is used to infer the edges of an underlying graph, MatlabBGL cannot distinguish between a 0-weight edge and an absent edge. To fix this problem, codes that accept a weighted graph allow the user to specify a vector of edge weights in an optional parameter. The easiest way to use this optional parameter is using a helper function called edge_weight¬ _vector. Given a weighted matrix pair (A, S), this function provides the appropriate optional argument when the graph has zero edge weights. Internally, this function computes the index of all the non-zero elements of A when using all of the structural non-zeros of S. An example helps to clarify what happens. We wish to create an undirected cycle where the weight of every edge is 0, except for a single edge with weight 1. n=8; E = [1:n 2:n 1; 2:n 1 1:n]’; w = [1 zeros(1,n-1) 1 zeros(1,n-1)]’; A = sparse(E(:,1), E(:,2), w, n, n); As = sparse(E(:,1), E(:,2), true, n, n); % create a structural sparse matrix ws = edge_weight_vector(As,A)’ % 8 vertices, % edge list for a cycle % weight of each edge % create a weighted sparse matrix The output reveals the single non-zero edge: The edge weight vector ws also satisfies the following property: [i j] = find(As); Aw = sparse(j,i,ws,size(As,1),size(As,2)); isequal(Aw,A) In other words, the order of the edge weight vector corresponds to the order of non-zeros in the transposed matrix. The function has to return weights in the order of the transposed matrix because MatlabBGL transposes the sparse matrix on a standard function call. 6.3 ⋅ matlabbgl 143 ws = Columns 1 through 11 10100000000 Columns 12 through 16 00000 ans = 1

PDF Image | Instagram Cheat Sheet

PDF Search Title:

Instagram Cheat Sheet

Original File Name Searched:

pagerank-sensitivity-thesis-online.pdf

DIY PDF Search: Google It | Yahoo | Bing

Cruise Ship Reviews | Luxury Resort | Jet | Yacht | and Travel Tech More Info

Cruising Review Topics and Articles More Info

Software based on Filemaker for the travel industry More Info

The Burgenstock Resort: Reviews on CruisingReview website... More Info

Resort Reviews: World Class resorts... More Info

The Riffelalp Resort: Reviews on CruisingReview website... More Info

CONTACT TEL: 608-238-6001 Email: greg@cruisingreview.com (Standard Web Page)