Question: So, basically I'm implementing an algorithm to calculate distances from one source node to every other node in a weighted graph, and if a node is in a negative cycle, it detects and marks that node as such.

My question regards the total time complexity of my algorithm. Assume `V` is number of nodes and `E` the number of edges.

The algorithm starts by asking E lines of input to specify the Edges of the graph and inserts it in the corresponding adjacency list. Such operation is `O(E)`

I apply the Bellman-Ford algorithm `V-1` times to know the distances and then I apply the algorithm `V-1` times once again to detect the Nodes in a negative cycle. This is `2 * O(VE) = O(VE)`.

I print a distances vector with the size `V` to display the distances and/or wether the node is in a negative cycle or not. `O(V)`.

So I guess my total complexity would be `O(VE + V + E)`. Now my question is: Since VE is almost always bigger than V+E (for large numbers, it's always!), can I drop the V+E in the complexity and make it simply `O(VE)`?

Answer: 
Sorry, but there is NO setting in **DOMPDF** to do that.  

To achieve your needs, you have to play with **CSS** files to custom your images size or text font size
DOMPDF has some issues with css and tables. Best practices are to avoid cell or rowspans and not using external css files. Also only a limited set of css rules are supported. Check out the full [CSSCompatibility list](http://code.google.com/p/dompdf/wiki/CSSCompatibility).

To fix your problem, have you try setting the inline style of the `img` to `style="max-width:100%; max-height:100%;"` ?

Here's a full example of scaling a large image (`4,256px × 2,832px`) inside one page :

```
<?php 
$html = <<< LOL
<html>
<head>
</head
<body>
<div width="100%"><img style="max-width:100%; max-height:100%;" src="http://www.norrbottenbigband.com/upload/images/norrbotten-big-band_hq.jpg"> </div>

</body>
</html>
LOL;

define("DOMPDF_ENABLE_HTML5PARSER", true);
define("DOMPDF_ENABLE_FONTSUBSETTING", true);
define("DOMPDF_UNICODE_ENABLED", true);
define("DOMPDF_DPI", 120);
define("DOMPDF_ENABLE_REMOTE", true);
//define("DOMPDF_ENABLE_JAVASCRIPT", true);
//define("DOMPDF_ENABLE_CSS_FLOAT", true);

require_once 'dompdf_config.inc.php';

$dompdf = new \DOMPDF();
$dompdf->load_html($html);
$dompdf->set_paper("a4", "portrait");
$dompdf->render();
$dompdf->stream("page.pdf", array("Attachment" => 0)); 

```

---

If none of the above works, try putting the output pdf inside a div with a specific size.